Skip to content

Instantly share code, notes, and snippets.

@DImuthuUpe
Created November 17, 2017 03:08
Show Gist options
  • Save DImuthuUpe/f61851b68b685b8d6744689dc130babd to your computer and use it in GitHub Desktop.
Save DImuthuUpe/f61851b68b685b8d6744689dc130babd to your computer and use it in GitHub Desktop.
private static Workflow.Builder createWorkflow() {
List<TaskConfig> downloadDataTasks = new ArrayList<>();
downloadDataTasks.add(new TaskConfig.Builder().setTaskId("Download_Task").setCommand(DataCollectingTask.NAME).build());
List<TaskConfig> commandExecuteTasks = new ArrayList<>();
commandExecuteTasks.add(new TaskConfig.Builder().setTaskId("Command_Task").setCommand(CommandTask.NAME).build());
List<TaskConfig> pushDataTasks = new ArrayList<>();
pushDataTasks.add(new TaskConfig.Builder().setTaskId("Push_Task").setCommand(DataPushingTask.NAME).build());
JobConfig.Builder downloadDataJob = new JobConfig.Builder().addTaskConfigs(downloadDataTasks).setMaxAttemptsPerTask(3);
JobConfig.Builder commandExecuteJob = new JobConfig.Builder().addTaskConfigs(commandExecuteTasks).setMaxAttemptsPerTask(3);
JobConfig.Builder dataPushJob = new JobConfig.Builder().addTaskConfigs(pushDataTasks).setMaxAttemptsPerTask(3);
Workflow.Builder workflow = new Workflow.Builder("Airavata_Workflow").setExpiry(0);
workflow.addJob("downloadDataJob", downloadDataJob);
workflow.addJob("commandExecuteJob", commandExecuteJob);
workflow.addJob("dataPushJob", dataPushJob);
workflow.addParentChildDependency("downloadDataJob", "commandExecuteJob");
workflow.addParentChildDependency("commandExecuteJob", "dataPushJob");
return workflow;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment