/** {@inheritDoc} */ @Nullable @Override protected Map<UUID, VisorCachePartitions> reduce0(List<ComputeJobResult> results) { Map<UUID, VisorCachePartitions> parts = new HashMap<>(); for (ComputeJobResult res : results) { if (res.getException() != null) throw res.getException(); parts.put(res.getNode().id(), res.getData()); } return parts; }
/**{@inheritDoc} */ @Override public Integer reduce(List<ComputeJobResult> results) { int sum = 0; for (ComputeJobResult r: results) { if (!r.isCancelled() && r.getException() == null) sum += r.<Integer>getData(); } return sum; } }
/** {@inheritDoc} */ @Override public ClusterNode getBalancedNode(List<ClusterNode> top) { return loadMgr.getBalancedNode(taskSes, top, jobRes.getJob()); }
/** {@inheritDoc} */ @Nullable @Override public Long reduce(List<ComputeJobResult> results) throws IgniteException { long size = 0; for (ComputeJobResult res : results) { if (res != null && res.getException() == null) size += res.<Long>getData(); } return size; } }
/** {@inheritDoc} */ @Nullable @Override protected Map<UUID, IgniteException> reduce0(List<ComputeJobResult> results) throws IgniteException { Map<UUID, IgniteException> map = new HashMap<>(); for (ComputeJobResult res : results) if (res.getException() != null) map.put(res.getNode().id(), res.getException()); return map; }
/** * {@inheritDoc} */ @Override public Integer reduce(List<ComputeJobResult> results) { return results.get(0).getData(); }
assert !done; PlatformAbstractJob job = res.getJob(); Object res0bj = res.getData(); writer.writeLong(job.pointer()); writer.writeUuid(res.getNode().id()); writer.writeBoolean(res.isCancelled()); IgniteException err = res.getException();
/** * @param res ComputeJobResult * @param rcvd List of ComputeJobResult * @return ComputeJobResultPolicy */ public ComputeJobResultPolicy result(ComputeJobResult res, List<ComputeJobResult> rcvd) { IgniteException err = res.getException(); if (err != null) return ComputeJobResultPolicy.FAILOVER; // If there is no exception, wait for all job results. return ComputeJobResultPolicy.WAIT; }
/** {@inheritDoc} */ @Nullable @Override protected Map<UUID, VisorNodeGcTaskResult> reduce0(List<ComputeJobResult> results) { Map<UUID, VisorNodeGcTaskResult> total = new HashMap<>(); for (ComputeJobResult res : results) { VisorNodeGcTaskResult jobRes = res.getData(); total.put(res.getNode().id(), jobRes); } return total; }
Integer failoverCnt = ctx.getJobResult().getJobContext().getAttribute(FAILOVER_ATTEMPT_COUNT_ATTR); ctx.getJobResult().getJob() + ", maxFailoverAttempts=" + maxFailoverAttempts + ']'); ctx.getJobResult().getJob() + ", maxFailoverAttempts=" + maxFailoverAttempts + ']'); UUID thiefId = ctx.getJobResult().getJobContext().getAttribute(THIEF_NODE_ATTR); ctx.getJobResult().getJobContext().setAttribute(THIEF_NODE_ATTR, null); if (thief.equals(ctx.getJobResult().getNode())) { U.error(log, "Job stealer node is equal to job node (will fail-over using " + "load-balancing): " + thief.id()); log.debug("Failing-over stolen job [from=" + ctx.getJobResult().getNode() + ", to=" + thief + ']'); Collection<UUID> failedNodes = ctx.getJobResult().getJobContext().getAttribute(FAILED_NODE_LIST_ATTR); failedNodes.add(ctx.getJobResult().getNode().id()); ctx.getJobResult().getJobContext().setAttribute(FAILED_NODE_LIST_ATTR, failedNodes); ctx.getJobResult().getJobContext().setAttribute(FAILOVER_ATTEMPT_COUNT_ATTR, failoverCnt); ", oldNode=" + ctx.getJobResult().getNode().id() + ", sesId=" + ctx.getTaskSession().getId() + ", job=" + ctx.getJobResult().getJob() + ", jobCtx=" + ctx.getJobResult().getJobContext() +
IgniteException e = jobRes.getException(); recordJobEvent(EVT_JOB_RESULTED, jobRes.getJobContext().getJobId(), jobRes.getNode(), plc, "Job got resulted with: " + plc);
/** {@inheritDoc} */ @Override public Integer reduce(List<ComputeJobResult> results) { int stoppedCnt = 0; for (ComputeJobResult res : results) if (!res.isCancelled()) stoppedCnt+=(Integer)res.getData(); return stoppedCnt; }
/** {@inheritDoc} */ @Override public Object reduce(List<ComputeJobResult> results) { for (ComputeJobResult res : results) { ComputeJobContext jobCtx = res.getJobContext(); assert jobCtx.getAttribute("nodeId").equals(res.getNode().id()); assert jobCtx.getAttributes().get("nodeId").equals(res.getNode().id()); assert jobCtx.getAttribute("jobId").equals(jobCtx.getJobId()); for (int i = 0; i < 10; i++) { String s = jobCtx.getJobId().toString() + i; assert jobCtx.getAttribute(s).equals(s); assert jobCtx.getAttributes().get(s).equals(s); } } return null; } }
/** {@inheritDoc} */ @Override public ClusterNode failover(FailoverContext ctx, List<ClusterNode> top) { failedOverJobs.add(ctx.getJobResult().getJobContext()); // Clear failed nodes list - allow to failover on the same node. ctx.getJobResult().getJobContext().setAttribute(FAILED_NODE_LIST_ATTR, null); // Account for maximum number of failover attempts since we clear failed node list. Integer failoverCnt = ctx.getJobResult().getJobContext().getAttribute(FAILOVER_NUMBER_ATTR); if (failoverCnt == null) ctx.getJobResult().getJobContext().setAttribute(FAILOVER_NUMBER_ATTR, 1); else { if (failoverCnt >= getMaximumFailoverAttempts()) { U.warn(log, "Job failover failed because number of maximum failover attempts is exceeded " + "[failedJob=" + ctx.getJobResult().getJob() + ", maxFailoverAttempts=" + getMaximumFailoverAttempts() + ']'); return null; } ctx.getJobResult().getJobContext().setAttribute(FAILOVER_NUMBER_ATTR, failoverCnt + 1); } List<ClusterNode> cp = new ArrayList<>(top); // Keep collection type. F.retain(cp, false, new IgnitePredicate<ClusterNode>() { @Override public boolean apply(ClusterNode node) { return F.isAll(node, filter); } }); return super.failover(ctx, cp); //use cp to ensure we don't failover on failed node }
/** {@inheritDoc} */ @Override public Object reduce(List<ComputeJobResult> results) { assert results.get(0).isCancelled() : "Wrong job result status."; return null; } }
assert results.size() == 3 : "Unexpected result count: " + results.size(); ClusterNode node = results.get(0).getNode();
/** * @param res Job result. * @param cnt Failure count. */ private void checkFailedNodes(ComputeJobResult res, int cnt) { Collection<UUID> failedNodes = (Collection<UUID>)res.getJobContext().getAttribute(FAILED_NODE_LIST_ATTR); assert failedNodes != null; assert failedNodes.size() == cnt; } }
/** {@inheritDoc} */ @Override public final Object reduce(List<ComputeJobResult> results) { assert results.size() == 1; ComputeJobResult res = results.get(0); if (res.getException() != null) throw res.getException(); return res.getData(); } }
/** * {@inheritDoc} */ @Override public Integer reduce(List<ComputeJobResult> results) { return results.get(0).getData(); }
assert !done; PlatformAbstractJob job = res.getJob(); Object res0bj = res.getData(); writer.writeLong(job.pointer()); writer.writeUuid(res.getNode().id()); writer.writeBoolean(res.isCancelled()); IgniteException err = res.getException();