use of org.apache.helix.task.WorkflowConfig in project helix by apache.
the class TestJobAccessor method testDeleteJob.
@Test(dependsOnMethods = "testCreateJob")
public void testDeleteJob() {
System.out.println("Start test :" + TestHelper.getTestMethodName());
TaskDriver driver = getTaskDriver(CLUSTER_NAME);
delete("clusters/" + CLUSTER_NAME + "/workflows/" + TEST_QUEUE_NAME + "/jobs/" + TEST_JOB_NAME, Response.Status.OK.getStatusCode());
String jobName = TaskUtil.getNamespacedJobName(TEST_QUEUE_NAME, TEST_JOB_NAME);
JobConfig jobConfig = driver.getJobConfig(jobName);
Assert.assertNull(jobConfig);
WorkflowConfig workflowConfig = driver.getWorkflowConfig(TEST_QUEUE_NAME);
Assert.assertTrue(!workflowConfig.getJobDag().getAllNodes().contains(jobName));
}
use of org.apache.helix.task.WorkflowConfig in project helix by apache.
the class JobAccessor method getJobs.
@GET
public Response getJobs(@PathParam("clusterId") String clusterId, @PathParam("workflowName") String workflowName) {
TaskDriver driver = getTaskDriver(clusterId);
WorkflowConfig workflowConfig = driver.getWorkflowConfig(workflowName);
ObjectNode root = JsonNodeFactory.instance.objectNode();
if (workflowConfig == null) {
return badRequest(String.format("Workflow %s is not found!", workflowName));
}
Set<String> jobs = workflowConfig.getJobDag().getAllNodes();
root.put(Properties.id.name(), JobProperties.Jobs.name());
ArrayNode jobsNode = root.putArray(JobProperties.Jobs.name());
if (jobs != null) {
jobsNode.addAll((ArrayNode) OBJECT_MAPPER.valueToTree(jobs));
}
return JSONRepresentation(root);
}
use of org.apache.helix.task.WorkflowConfig in project helix by apache.
the class TaskDataCache method refresh.
/**
* This refreshes the cluster data by re-fetching the data from zookeeper in an efficient way
*
* @param accessor
*
* @return
*/
public synchronized boolean refresh(HelixDataAccessor accessor, Map<String, ResourceConfig> resourceConfigMap) {
refreshJobContexts(accessor);
// update workflow and job configs.
_workflowConfigMap.clear();
_jobConfigMap.clear();
for (Map.Entry<String, ResourceConfig> entry : resourceConfigMap.entrySet()) {
if (entry.getValue().getRecord().getSimpleFields().containsKey(WorkflowConfig.WorkflowConfigProperty.Dag.name())) {
_workflowConfigMap.put(entry.getKey(), new WorkflowConfig(entry.getValue()));
} else if (entry.getValue().getRecord().getSimpleFields().containsKey(WorkflowConfig.WorkflowConfigProperty.WorkflowID.name())) {
_jobConfigMap.put(entry.getKey(), new JobConfig(entry.getValue()));
}
}
return true;
}
Aggregations