Example #1
0
def test_draw_networkx():
    task0 = BaseTask("auto", auto_task=True)
    task1 = BaseTask("task1")
    task1.start_time_list = [1]
    task1.ready_time_list = [0]
    task1.finish_time_list = [3]
    task2 = BaseTask("task2")
    task2.start_time_list = [4]
    task2.ready_time_list = [4]
    task2.finish_time_list = [6]
    task2.append_input_task(task1)
    w = BaseWorkflow([task1, task2, task0])
    w.draw_networkx(save_fig_path="test.png")
    if os.path.exists("test.png"):
        os.remove("test.png")
Example #2
0
def test_draw_networkx(tmpdir):
    """test_draw_networkx."""
    task0 = BaseTask("auto", auto_task=True)
    task1 = BaseTask("task1")
    task1.state_record_list = [
        BaseTaskState.READY,
        BaseTaskState.READY,
        BaseTaskState.WORKING,
        BaseTaskState.FINISHED,
        BaseTaskState.FINISHED,
    ]
    task2 = BaseTask("task2")
    task2.state_record_list = [
        BaseTaskState.READY,
        BaseTaskState.READY,
        BaseTaskState.WORKING,
        BaseTaskState.FINISHED,
        BaseTaskState.FINISHED,
    ]
    task2.append_input_task(task1)
    w = BaseWorkflow([task1, task2, task0])
    for ext in ["png"]:
        save_fig_path = os.path.join(str(tmpdir), "test." + ext)
        w.draw_networkx(save_fig_path=save_fig_path)