use of org.apache.hyracks.control.cc.job.IJobManager in project asterixdb by apache.
the class TaskFailureWork method performEvent.
@Override
protected void performEvent(TaskAttempt ta) {
IJobManager jobManager = ccs.getJobManager();
JobRun run = jobManager.get(jobId);
ccs.getDatasetDirectoryService().reportJobFailure(jobId, exceptions);
run.getExecutor().notifyTaskFailure(ta, exceptions);
}
use of org.apache.hyracks.control.cc.job.IJobManager in project asterixdb by apache.
the class JobExecutor method notifyNodeFailures.
/**
* Indicates that the provided set of nodes have left the cluster.
*
* @param deadNodes
* - Set of failed nodes
*/
public void notifyNodeFailures(Collection<String> deadNodes) {
try {
jobRun.getPartitionMatchMaker().notifyNodeFailures(deadNodes);
jobRun.getParticipatingNodeIds().removeAll(deadNodes);
jobRun.getCleanupPendingNodeIds().removeAll(deadNodes);
if (jobRun.getPendingStatus() != null && jobRun.getCleanupPendingNodeIds().isEmpty()) {
IJobManager jobManager = ccs.getJobManager();
jobManager.finalComplete(jobRun);
return;
}
abortOngoingTaskClusters(ta -> deadNodes.contains(ta.getNodeId()), ta -> HyracksException.create(ErrorCode.NODE_FAILED, ta.getNodeId()));
startRunnableActivityClusters();
} catch (Exception e) {
abortJob(Collections.singletonList(e));
}
}
use of org.apache.hyracks.control.cc.job.IJobManager in project asterixdb by apache.
the class ClusterControllerService method startApplication.
private void startApplication() throws Exception {
serviceCtx = new CCServiceContext(this, serverCtx, ccContext, ccConfig.getAppConfig());
serviceCtx.addJobLifecycleListener(datasetDirectoryService);
executor = Executors.newCachedThreadPool(serviceCtx.getThreadFactory());
application.start(serviceCtx, ccConfig.getAppArgsArray());
IJobCapacityController jobCapacityController = application.getJobCapacityController();
// Job manager is in charge of job lifecycle management.
try {
Constructor<?> jobManagerConstructor = this.getClass().getClassLoader().loadClass(ccConfig.getJobManagerClass()).getConstructor(CCConfig.class, ClusterControllerService.class, IJobCapacityController.class);
jobManager = (IJobManager) jobManagerConstructor.newInstance(ccConfig, this, jobCapacityController);
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
if (LOGGER.isLoggable(Level.WARNING)) {
LOGGER.log(Level.WARNING, "class " + ccConfig.getJobManagerClass() + " could not be used: ", e);
}
// Falls back to the default implementation if the user-provided class name is not valid.
jobManager = new JobManager(ccConfig, this, jobCapacityController);
}
}
use of org.apache.hyracks.control.cc.job.IJobManager in project asterixdb by apache.
the class AbstractTaskLifecycleWork method runWork.
@Override
public final void runWork() {
IJobManager jobManager = ccs.getJobManager();
JobRun run = jobManager.get(jobId);
if (run != null) {
TaskId tid = taId.getTaskId();
Map<ActivityId, ActivityCluster> activityClusterMap = run.getActivityClusterGraph().getActivityMap();
ActivityCluster ac = activityClusterMap.get(tid.getActivityId());
if (ac != null) {
Map<ActivityId, ActivityPlan> taskStateMap = run.getActivityClusterPlanMap().get(ac.getId()).getActivityPlanMap();
Task[] taskStates = taskStateMap.get(tid.getActivityId()).getTasks();
if (taskStates != null && taskStates.length > tid.getPartition()) {
Task ts = taskStates[tid.getPartition()];
TaskCluster tc = ts.getTaskCluster();
List<TaskClusterAttempt> taskClusterAttempts = tc.getAttempts();
if (taskClusterAttempts != null && taskClusterAttempts.size() > taId.getAttempt()) {
TaskClusterAttempt tca = taskClusterAttempts.get(taId.getAttempt());
TaskAttempt ta = tca.getTaskAttempts().get(tid);
if (ta != null) {
performEvent(ta);
}
}
}
}
}
}
use of org.apache.hyracks.control.cc.job.IJobManager in project asterixdb by apache.
the class GetActivityClusterGraphJSONWork method doRun.
@Override
protected void doRun() throws Exception {
IJobManager jobManager = ccs.getJobManager();
ObjectMapper om = new ObjectMapper();
JobRun run = jobManager.get(jobId);
if (run == null) {
json = om.createObjectNode();
return;
}
json = run.getActivityClusterGraph().toJSON();
}
Aggregations