コード例 #1
0
ファイル: Inspect.py プロジェクト: FYQ0919/SmartContract-QC
                        winner_dict.get("winner_qc_list", None))
                    winner_score_list.append(winner_dict.get("score", None))
                    winner_results_list.append(winner_dict.get(
                        "results", None))
                    consent_list.append(consent)
                    time.sleep(.1)
                # Consent achieved for that row
                # Append log data to dataframe
                df = csv_functions.append_to_df(df, data)
                # print(df)
            # Write dataframe into csv
            csv_functions.write_csv(filename, df)
        print(
            "====================================== PROGRAM END ======================================"
        )


if __name__ == '__main__':
    QC = QC_simulation()

    qc, wp, trans = QC.instantiate_objects(threshold=5,
                                           consensus_mode="majority")
    add_routes(qc, threshold=5)
    t = Thread(target=QC.simulate, args=(
        qc,
        wp,
        trans,
    ))
    t.start()
    app.run(host='0.0.0.0', port=QC.port)
コード例 #2
0
                # Write dataframe into csv
                csv_functions.write_csv(filename, df)

        # Add time interval
        time_step += time_interval
        # Termination condition
        if all(wp_inst.status == "completed"
               for wp_id, wp_inst in workpieces.items()):
            break

        time.sleep(.1)

    # Write dataframe into csv
    csv_functions.write_csv(filename, df)
    print(
        "====================================== PROGRAM END ======================================"
    )


if __name__ == '__main__':
    qc, wp, trans, pc = instantiate_objects(threshold, score_list, learning)
    add_routes(qc, threshold)
    t = Thread(target=simulate, args=(
        qc,
        wp,
        trans,
        pc,
    ))
    t.start()
    app.run(host='0.0.0.0', port=port)
コード例 #3
0
def run():
    app.run()
    time.sleep(1)