use of alluxio.collections.ConcurrentHashSet in project alluxio by Alluxio.
the class WorkflowTracker method next.
private synchronized void next(long jobId) {
WorkflowExecution workflowExecution = mWorkflows.get(jobId);
mChildren.putIfAbsent(jobId, new ConcurrentHashSet<>());
Set<JobConfig> childJobConfigs = workflowExecution.next();
if (childJobConfigs.isEmpty()) {
done(jobId);
return;
}
ConcurrentHashSet<Long> childJobIds = new ConcurrentHashSet<>();
for (int i = 0; i < childJobConfigs.size(); i++) {
childJobIds.add(mJobMaster.getNewJobId());
}
mWaitingOn.put(jobId, childJobIds);
mChildren.get(jobId).addAll(childJobIds);
for (Long childJobId : childJobIds) {
mParentWorkflow.put(childJobId, jobId);
}
Iterator<Long> childJobIdsIter = childJobIds.iterator();
Iterator<JobConfig> childJobConfigsIter = childJobConfigs.iterator();
while (childJobIdsIter.hasNext() && childJobConfigsIter.hasNext()) {
Long childJobId = childJobIdsIter.next();
JobConfig childJobConfig = childJobConfigsIter.next();
try {
mJobMaster.run(childJobConfig, childJobId);
} catch (JobDoesNotExistException | ResourceExhaustedException e) {
LOG.warn(e.getMessage());
final String errorType = ErrorUtils.getErrorType(e);
workflowExecution.stop(Status.FAILED, errorType, e.getMessage());
stop(jobId, Status.FAILED, errorType, e.getMessage());
}
}
}
Aggregations