/** <inheritDoc /> */ public ComputeJobResultPolicy Result(IComputeJobResult <object> res, IList <IComputeJobResult <object> > rcvd) { if (res.Exception() != null) { JobErrs.Add(res.Exception()); } else { object res0 = res.Data(); bool rmt = res0 is GoodJobResult ? ((GoodJobResult)res0).Rmt : ((BadJobResult)res0).Rmt; if (rmt) { switch (Mode) { case ErrorMode.RmtResErr: throw new GoodException(ErrorMode.RmtResErr); case ErrorMode.RmtResErrNotMarshalable: throw new BadException(ErrorMode.RmtResErrNotMarshalable); } } else { switch (Mode) { case ErrorMode.LocResErr: throw new GoodException(ErrorMode.LocResErr); case ErrorMode.LocResErrNotMarshalable: throw new BadException(ErrorMode.LocResErrNotMarshalable); } } _res += 1; } return(ComputeJobResultPolicy.Wait); }
/// <summary> /// Asynchronous callback invoked every time a result from remote execution is /// received. It is ultimately upto this method to return a policy based /// on which the system will either wait for more results, reduce results /// received so far, or failover this job to another node. See /// <see cref="ComputeJobResultPolicy" /> for more information. /// </summary> /// <param name="res">Received remote Ignite executable result.</param> /// <param name="rcvd">All previously received results. Note that if task class has /// <see cref="ComputeTaskNoResultCacheAttribute" /> attribute, then this list will be empty.</param> /// <returns> /// Result policy that dictates how to process further upcoming job results. /// </returns> public ComputeJobResultPolicy Result(IComputeJobResult <T> res, IList <IComputeJobResult <T> > rcvd) { Exception err = res.Exception(); if (err != null) { if (err is ComputeExecutionRejectedException || err is ClusterTopologyException || err is ComputeJobFailoverException) { return(ComputeJobResultPolicy.Failover); } throw err; } return(Result0(res)); }
/// <summary> /// Default implementation which will wait for all jobs to complete before /// calling <see cref="IComputeTask{A,T,R}.Reduce"/> method. /// <p/> /// If remote job resulted in exception <see cref="IComputeJobResult{T}.Exception()"/> /// is not <c>null</c>), /// then <see cref="ComputeJobResultPolicy.Failover"/> policy will be returned if /// the exception is instance of <see cref="ClusterTopologyException"/> /// or <see cref="ComputeExecutionRejectedException"/>, which means that /// remote node either failed or job execution was rejected before it got a chance to start. In all /// other cases the exception will be rethrown which will ultimately cause task to fail. /// </summary> /// <param name="res">Received remote Ignite executable result.</param> /// <param name="rcvd">All previously received results.</param> /// <returns>Result policy that dictates how to process further upcoming job results.</returns> public virtual ComputeJobResultPolicy Result(IComputeJobResult <T> res, IList <IComputeJobResult <T> > rcvd) { Exception err = res.Exception(); if (err != null) { if (err is ComputeExecutionRejectedException || err is ClusterTopologyException || err is ComputeJobFailoverException) { return(ComputeJobResultPolicy.Failover); } throw new IgniteException("Remote job threw user exception (override or implement IComputeTask.result(..) " + "method if you would like to have automatic failover for this exception).", err); } return(ComputeJobResultPolicy.Wait); }
/** <inheritdoc /> */ public Exception Exception() { return(_wrappedRes.Exception()); }