Search in sources :

Example 11 with ConcurrentHashSet

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());
        }
    }
}
Also used : JobDoesNotExistException(alluxio.exception.JobDoesNotExistException) JobConfig(alluxio.job.JobConfig) ResourceExhaustedException(alluxio.exception.status.ResourceExhaustedException) ConcurrentHashSet(alluxio.collections.ConcurrentHashSet) WorkflowExecution(alluxio.job.workflow.WorkflowExecution)

Aggregations

ConcurrentHashSet (alluxio.collections.ConcurrentHashSet)11 CyclicBarrier (java.util.concurrent.CyclicBarrier)6 AlluxioURI (alluxio.AlluxioURI)5 ArrayList (java.util.ArrayList)5 Test (org.junit.Test)5 URIStatus (alluxio.client.file.URIStatus)4 AlluxioException (alluxio.exception.AlluxioException)3 FileDoesNotExistException (alluxio.exception.FileDoesNotExistException)2 InvalidPathException (alluxio.exception.InvalidPathException)2 BaseIntegrationTest (alluxio.testutils.BaseIntegrationTest)2 Constants (alluxio.Constants)1 AggregateException (alluxio.exception.AggregateException)1 BlockDoesNotExistException (alluxio.exception.BlockDoesNotExistException)1 InvalidWorkerStateException (alluxio.exception.InvalidWorkerStateException)1 JobDoesNotExistException (alluxio.exception.JobDoesNotExistException)1 InvalidArgumentException (alluxio.exception.status.InvalidArgumentException)1 ResourceExhaustedException (alluxio.exception.status.ResourceExhaustedException)1 DeletePOptions (alluxio.grpc.DeletePOptions)1 ReadRequest (alluxio.grpc.ReadRequest)1 ReadResponse (alluxio.grpc.ReadResponse)1