@Override public RecordDescriptor getInputRecordDescriptor(ActivityId aid, int inputIndex) { ActivityCluster ac = acg.getActivityMap().get(aid); IConnectorDescriptor conn = ac.getActivityInputMap().get(aid).get(inputIndex); return ac.getConnectorRecordDescriptorMap().get(conn.getConnectorId()); } };
@Override public RecordDescriptor getOutputRecordDescriptor(ActivityId aid, int outputIndex) { ActivityCluster ac = acg.getActivityMap().get(aid); IConnectorDescriptor conn = ac.getActivityOutputMap().get(aid).get(outputIndex); return ac.getConnectorRecordDescriptorMap().get(conn.getConnectorId()); }
/** * rewrite an activity cluster graph to eliminate * all one-to-one connections and merge one-to-one connected * DAGs into super activities. * * @param acg * the activity cluster graph */ public void rewrite(ActivityClusterGraph acg) { acg.getActivityMap().clear(); acg.getConnectorMap().clear(); Map<IActivity, SuperActivity> invertedActivitySuperActivityMap = new HashMap<>(); acg.getActivityClusterMap() .forEach((key, value) -> rewriteIntraActivityCluster(value, invertedActivitySuperActivityMap)); acg.getActivityClusterMap() .forEach((key, value) -> rewriteInterActivityCluster(value, invertedActivitySuperActivityMap)); invertedActivitySuperActivityMap.clear(); }
replacedBlockers.add(invertedAid2SuperAidMap.get(blocker)); ActivityCluster dependingAc = ac.getActivityClusterGraph().getActivityMap().get(invertedAid2SuperAidMap.get(blocker)); if (!ac.getDependencies().contains(dependingAc)) { ac.getDependencies().add(dependingAc);
private String findTaskLocation(TaskId tid) { ActivityId aid = tid.getActivityId(); ActivityCluster ac = jobRun.getActivityClusterGraph().getActivityMap().get(aid); Task[] tasks = getActivityClusterPlan(ac).getActivityPlanMap().get(aid).getTasks(); List<TaskClusterAttempt> tcAttempts = tasks[tid.getPartition()].getTaskCluster().getAttempts(); if (tcAttempts == null || tcAttempts.isEmpty()) { return null; } TaskClusterAttempt lastTCA = tcAttempts.get(tcAttempts.size() - 1); TaskAttempt ta = lastTCA.getTaskAttempts().get(tid); return ta == null ? null : ta.getNodeId(); }
BitSet targetBitmap = new BitSet(); for (ActivityId ac1 : activities) { ActivityCluster ac = acg.getActivityMap().get(ac1); Task[] ac1TaskStates = activityPlanMap.get(ac1).getTasks(); int nProducers = ac1TaskStates.length;
tasks[i] = new Task(tid, activityPlan); for (ActivityId danId : depAnIds) { ActivityCluster dAC = ac.getActivityClusterGraph().getActivityMap().get(danId); ActivityClusterPlan dACP = jobRun.getActivityClusterPlanMap().get(dAC.getId()); assert dACP != null : "IllegalStateEncountered: Dependent AC is being planned without a plan for "
private TaskCluster getTaskCluster(TaskId tid) { JobRun run = executor.getJobRun(); ActivityCluster ac = run.getActivityClusterGraph().getActivityMap().get(tid.getActivityId()); ActivityClusterPlan acp = run.getActivityClusterPlanMap().get(ac.getId()); Task[] tasks = acp.getActivityPlanMap().get(tid.getActivityId()).getTasks(); Task task = tasks[tid.getPartition()]; assert task.getTaskId().equals(tid); return task.getTaskCluster(); }
private String assignLocation(ActivityClusterGraph acg, Map<TaskId, LValueConstraintExpression> locationMap, TaskId tid, TaskAttempt taskAttempt) throws HyracksException { ActivityId aid = tid.getActivityId(); ActivityCluster ac = acg.getActivityMap().get(aid); Set<ActivityId> blockers = ac.getBlocked2BlockerMap().get(aid); String nodeId = null;
superActivities.forEach((key, value) -> { newActivityCluster.addActivity(value); acg.getActivityMap().put(key, newActivityCluster); });
@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); } } } } } }
TaskId tid = taId.getTaskId(); ActivityId aid = tid.getActivityId(); ActivityCluster ac = acg.getActivityMap().get(aid); IActivity han = ac.getActivityMap().get(aid); LOGGER.trace("Initializing {} -> {} for {}", taId, han, jobId);