def create_bash_workflow() -> Workflow: workflow = Workflow() workflow.project_desc = ProjectDesc() workflow.project_desc.project_name = "workflow_1" for i in range(3): job = TestDAGGenerator.create_bash_job(i) workflow.add_job(job) deps_1 = [ JobControlEdge(target_node_id='', source_node_id='1_job', met_config=MetConfig( event_key='key_1', event_value='value_1', event_type=UNDEFINED_EVENT_TYPE)) ] deps_2 = [ JobControlEdge(target_node_id='', source_node_id='2_job', met_config=MetConfig( event_key='key_2', event_value='value_2', event_type=UNDEFINED_EVENT_TYPE)) ] workflow.add_edges("1_job", deps_1) workflow.add_edges("2_job", deps_2) workflow.workflow_id = 1 return workflow
def create_stream_workflow() -> Workflow: workflow = Workflow() for i in range(3): job = TestScheduler.create_job(i, 5) workflow.add_job(job) deps = [] deps.append( JobControlEdge(target_node_id='0_job', source_node_id='2_job', met_config=MetConfig( event_key=generate_job_status_key('0_job'), event_value=State.FINISHED.value))) deps.append( JobControlEdge(target_node_id='1_job', source_node_id='2_job', met_config=MetConfig( event_key=generate_job_status_key('1_job'), event_value=State.FINISHED.value))) workflow.add_edges("2_job", deps) workflow.workflow_id = 1 job = TestScheduler.create_job(3, 1) workflow.add_job(job) dep2 = [] dep2.append( JobControlEdge(target_node_id='0_job', source_node_id='3_job', met_config=MetConfig(event_key='key1', event_value='value1'))) workflow.add_edges('3_job', dep2) return workflow
def create_restart_job_workflow() -> Workflow: workflow = Workflow() for i in range(2): job = TestScheduler.create_periodic_job(i, 4) workflow.add_job(job) job = TestScheduler.create_periodic_job(2, 20) job.job_config.periodic_config = None workflow.add_job(job) deps = [] deps.append( JobControlEdge(target_node_id='0_job', source_node_id='2_job', met_config=MetConfig( event_key=generate_job_status_key('0_job'), event_value=State.FINISHED.value, action=TaskAction.RESTART))) deps.append( JobControlEdge(target_node_id='1_job', source_node_id='2_job', met_config=MetConfig( event_key=generate_job_status_key('1_job'), event_value=State.FINISHED.value, action=TaskAction.RESTART))) workflow.add_edges("2_job", deps) workflow.workflow_id = 1 return workflow
def create_longrun_workflow() -> Workflow: workflow = Workflow() job_0 = TestScheduler.create_job(0, 10000) workflow.add_job(job_0) job_1 = TestScheduler.create_job(1, 1) workflow.add_job(job_1) deps = [] deps.append( JobControlEdge(target_node_id='1_job', source_node_id='0_job', met_config=MetConfig(event_key='key_1', event_value='value_1', event_type='stop', action=TaskAction.STOP))) workflow.add_edges("0_job", deps) workflow.workflow_id = 1 return workflow
def create_workflow() -> Workflow: workflow = Workflow() workflow.project_desc = ProjectDesc() workflow.project_desc.project_name = "workflow_1" for i in range(6): job = TestDAGGenerator.create_dummy_job(i) if i == 2: job.job_config = SendEventJobConfig('localhost:50051', 'key_1', 'value_1', UNDEFINED_EVENT_TYPE) elif i == 3: job.job_config = SendEventJobConfig('localhost:50051', 'key_2', 'value_2', UNDEFINED_EVENT_TYPE) elif i == 5: job.job_config = SendEventJobConfig('localhost:50051', 'key_2', 'value_2', "STOP_SCHEDULER_CMD") workflow.add_job(job) dependencies = [ JobControlEdge(target_node_id='0_job', source_node_id='2_job', met_config=MetConfig( event_key=generate_job_status_key('0_job'), event_value=State.FINISHED.value)), JobControlEdge(target_node_id='1_job', source_node_id='2_job', met_config=MetConfig( event_key=generate_job_status_key('1_job'), event_value=State.FINISHED.value)) ] workflow.add_edges("2_job", dependencies) dependencies = [ JobControlEdge(target_node_id='2_job', source_node_id='4_job', met_config=MetConfig( event_key='key_1', event_value='value_1', event_type=UNDEFINED_EVENT_TYPE)), JobControlEdge(target_node_id='3_job', source_node_id='4_job', met_config=MetConfig( event_key='key_2', event_value='value_2', event_type=UNDEFINED_EVENT_TYPE)) ] workflow.add_edges("4_job", dependencies) dependencies = [ JobControlEdge(target_node_id='4_job', source_node_id='5_job', met_config=MetConfig( event_key=generate_job_status_key('5_job'), event_value=State.FINISHED.value)) ] workflow.add_edges("5_job", dependencies) workflow.workflow_id = 1 return workflow