use of com.twitter.hraven.Flow in project ambrose by twitter.
the class HRavenWorkflowIndexReadService method getWorkflows.
@Override
public PaginatedList<WorkflowSummary> getWorkflows(String cluster, Status status, String username, int numResults, byte[] nextPageStart) throws IOException {
List<WorkflowSummary> workflowSummaryList = Lists.newArrayList();
PaginatedResult<Flow> flows = flowQueueService.getPaginatedFlowsForStatus(cluster, convertStatus(status), numResults, username, nextPageStart);
for (Flow flow : flows.getValues()) {
workflowSummaryList.add(toWorkflowSummary(flow));
}
PaginatedList<WorkflowSummary> paginatedList = new PaginatedList<WorkflowSummary>(workflowSummaryList);
if (flows.getNextStartRow() != null) {
paginatedList.setNextPageStart(new String(Base64.encode(flows.getNextStartRow())));
}
return paginatedList;
}
use of com.twitter.hraven.Flow in project ambrose by twitter.
the class HRavenStatsWriteService method updateFlowQueue.
private void updateFlowQueue(FlowQueueKey key, Integer progress) throws IOException {
Flow flow = new Flow(flowKey);
if (progress != null) {
flow.setProgress(progress);
}
flow.setQueueKey(key);
flow.setFlowName(appId);
flow.setUserName(username);
flow.setJobGraphJSON(JSONUtil.toJson(dagNodeNameMap));
hRavenPool.submit(new HRavenQueueRunnable(flowQueueService, flowQueueKey, flow));
}
use of com.twitter.hraven.Flow in project ambrose by twitter.
the class HRavenStatsReadService method getDagNodeNameMap.
/**
* Gets the dag nodes for this workflowId. Returns null if the workflow does not exist.
*
* @param workflowId the id of the workflow
* @return a map of nodeIds to DAGNodes
* @throws IOException
*/
@SuppressWarnings("rawtypes")
@Override
public Map<String, DAGNode> getDagNodeNameMap(String workflowId) throws IOException {
WorkflowId id = WorkflowId.parseString(workflowId);
Flow flow = flowQueueService.getFlowFromQueue(id.getCluster(), id.getTimestamp(), id.getFlowId());
if (flow == null) {
return null;
}
// TODO This may not work nicely with multiple type of jobs
// See: https://github.com/twitter/ambrose/pull/131
Map<String, DAGNode> dagMap = JSONUtil.toObject(flow.getJobGraphJSON(), new TypeReference<Map<String, DAGNode>>() {
});
return dagMap;
}
Aggregations