Example #1
0
def test_create_gantt_plotly(tmpdir):
    """test_create_gantt_plotly."""
    task1 = Task("task1")
    task1.state_record_list = [
        BaseTaskState.READY,
        BaseTaskState.READY,
        BaseTaskState.WORKING,
        BaseTaskState.FINISHED,
        BaseTaskState.FINISHED,
    ]
    task2 = Task("task2")
    task2.state_record_list = [
        BaseTaskState.READY,
        BaseTaskState.READY,
        BaseTaskState.WORKING,
        BaseTaskState.FINISHED,
        BaseTaskState.FINISHED,
    ]
    task2.append_input_task(task1)
    w = Workflow([task1, task2])
    init_datetime = datetime.datetime(2020, 4, 1, 8, 0, 0)
    timedelta = datetime.timedelta(days=1)
    w.create_gantt_plotly(init_datetime,
                          timedelta,
                          save_fig_path=os.path.join(str(tmpdir), "test.png"))
Example #2
0
def test_create_gantt_plotly():
    task1 = Task("task1")
    task1.start_time_list = [1]
    task1.ready_time_list = [0]
    task1.finish_time_list = [3]
    task2 = Task("task2")
    task2.start_time_list = [4]
    task2.ready_time_list = [4]
    task2.finish_time_list = [6]
    task2.append_input_task(task1)
    w = Workflow([task1, task2])
    init_datetime = datetime.datetime(2020, 4, 1, 8, 0, 0)
    timedelta = datetime.timedelta(days=1)
    w.create_gantt_plotly(init_datetime, timedelta, save_fig_path="test.png")
    if os.path.exists("test.png"):
        os.remove("test.png")