/** {@inheritDoc} */ @Override public GridComputeJobResultPolicy result(GridComputeJobResult res, List<GridComputeJobResult> rcvd) throws GridException { // No failover for this task. if (res.getException() != null) throw res.getException(); return GridComputeJobResultPolicy.WAIT; }
/** {@inheritDoc} */ @Override public GridComputeJobResultPolicy result(GridComputeJobResult res, List<GridComputeJobResult> rcvd) throws GridException { // No failover. if (res.getException() != null) throw res.getException(); return GridComputeJobResultPolicy.WAIT; }
/** {@inheritDoc} */ @Override public final Object reduce(List<GridComputeJobResult> results) throws GridException { assert results.size() == 1; GridComputeJobResult res = results.get(0); if (res.getException() != null) throw res.getException(); return res.getData(); } }
/** {@inheritDoc} */ @Override public final Collection<?> reduce(List<GridComputeJobResult> results) throws GridException { assert results.size() >= 1; Collection<Object> data = new ArrayList<>(results.size()); for (GridComputeJobResult res : results) { if (res.getException() != null) throw res.getException(); data.add(res.getData()); } return data; }
/** {@inheritDoc} */ @Nullable @Override protected R reduce0(List<GridComputeJobResult> results) throws GridException { assert results.size() == 1; GridComputeJobResult res = F.first(results); if (res.getException() == null) return res.getData(); throw res.getException(); } }
/** {@inheritDoc} */ @Override public GridComputeJobResultPolicy result(GridComputeJobResult res, List<GridComputeJobResult> rcvd) throws GridException { // No failover for this task. if (res.getException() != null) throw res.getException(); rdc.collect(res.<R1>getData()); return GridComputeJobResultPolicy.WAIT; }
/** {@inheritDoc} */ @Override protected Iterable<? extends VisorGridEvent> reduce0(List<GridComputeJobResult> results) throws GridException { Collection<VisorGridEvent> allEvents = new ArrayList<>(); for (GridComputeJobResult r : results) { if (r.getException() == null) allEvents.addAll((Collection<VisorGridEvent>) r.getData()); } return allEvents.isEmpty() ? Collections.<VisorGridEvent>emptyList() : allEvents; }
/** {@inheritDoc} */ @Override public R reduce(List<GridComputeJobResult> res) throws GridException { for (GridComputeJobResult r : res) { if (r.getException() == null) return r.getData(); } throw new GridException("Failed to find successful job result: " + res); } }
/** {@inheritDoc} */ @Override public R reduce(List<GridComputeJobResult> res) throws GridException { for (GridComputeJobResult r : res) if (r.getException() == null) return r.getData(); throw new GridException("Failed to find successful job result: " + res); } }
/** {@inheritDoc} */ @Nullable @Override protected Iterable<GridBiTuple<UUID, VisorLicense>> reduce0(List<GridComputeJobResult> results) throws GridException { Collection<GridBiTuple<UUID, VisorLicense>> licenses = new ArrayList<>(results.size()); for (GridComputeJobResult r : results) { VisorLicense license = r.getException() != null ? null : (VisorLicense) r.getData(); licenses.add(new GridBiTuple<>(r.getNode().id(), license)); } return licenses; }
/** {@inheritDoc} */ @Override public R reduce(List<GridComputeJobResult> res) throws GridException { for (GridComputeJobResult r : res) if (r.getException() == null) return r.getData(); throw new GridException("Failed to find successful job result: " + res); } }
/** {@inheritDoc} */ @Nullable @Override protected GridBiTuple<Iterable<GridBiTuple<Exception, UUID>>, Iterable<VisorLogSearchResult>> reduce0(List<GridComputeJobResult> results) throws GridException { Collection<VisorLogSearchResult> searchRes = new ArrayList<>(); Collection<GridBiTuple<Exception, UUID>> exRes = new ArrayList<>(); // Separate successfully executed results and exceptions. for (GridComputeJobResult result : results) { if (result.getException() != null) exRes.add(new GridBiTuple<Exception, UUID>(result.getException(), result.getNode().id())); else if(result.getData() != null) { Collection<VisorLogSearchResult> data = result.getData(); searchRes.addAll(data); } } return new GridBiTuple<Iterable<GridBiTuple<Exception, UUID>>, Iterable<VisorLogSearchResult>> (exRes.isEmpty() ? null : exRes, searchRes.isEmpty() ? null : searchRes); } /**
UUID nid = res.getNode().id(); GridException unhandledEx = res.getException();
/** {@inheritDoc} */ @Override public GridComputeJobResultPolicy result(GridComputeJobResult res, List<GridComputeJobResult> rcvd) throws GridException { GridComputeJobResultPolicy resPlc = super.result(res, rcvd); if (res.getException() == null && resPlc != FAILOVER && !rdc.collect((R1) res.getData())) resPlc = REDUCE; // If reducer returned false - reduce right away. return resPlc; }
/** {@inheritDoc} */ @Override public byte[] reduce(List<GridComputeJobResult> results) throws GridException { byte status; byte[] bytes; GridComputeJobResult res = F.first(results); if (res.getException() == null) { status = 0; bytes = MARSHALLER.marshal(res.getData()); } else { status = 1; bytes = MARSHALLER.marshal(new SQLException(res.getException().getMessage())); } byte[] packet = new byte[bytes.length + 1]; packet[0] = status; U.arrayCopy(bytes, 0, packet, 1, bytes.length); return packet; }
GridException e = res.getException();
/** {@inheritDoc} */ @Override public GridComputeJobResultPolicy result(GridComputeJobResult res, List<GridComputeJobResult> rcvd) throws GridException { GridComputeJobResultPolicy resPlc = super.result(res, rcvd); if (res.getException() == null && resPlc != FAILOVER && !t.get3().collect((R1)res.getData())) resPlc = REDUCE; // If reducer returned false - reduce right away. return resPlc; }
if (res.getException() == null && res.getData() instanceof Collection<?>) { Collection<VisorCacheMetrics> cms = res.getData(); for (VisorCacheMetrics cm : cms) {
GridException e = jobRes.getException();