コード例 #1
0
        public void EndTask(string nodeName, EndTaskArg arg, NodeCommunicatorCallBack <EndTaskArg> callback)
        {
            this.SendRequest("endtask", this.GetCallbackUri(nodeName, "taskcompleted"), nodeName, async(content, ex) =>
            {
                Exception readEx = null;

                try
                {
                    if (content != null && ex == null)
                    {
                        arg.TaskInfo = await content.ReadAsAsync <ComputeClusterTaskInformation>();
                    }
                }
                catch (Exception e)
                {
                    this.Tracer.TraceError("Exception while read the task info {0}", e);

                    readEx = e;
                }

                if (ex != null && readEx != null)
                {
                    ex = new AggregateException(ex, readEx);
                }
                else
                {
                    ex = ex ?? readEx;
                }

                callback(nodeName, arg, ex);
            }, arg);
        }
コード例 #2
0
 public async Tasks.Task <string> EndTaskAsync(string nodeName, EndTaskArg arg, CancellationToken token)
 {
     return(await this.SendRequestAsync("endtask",
                                        this.GetCallbackUri(nodeName, "taskcompleted"),
                                        nodeName,
                                        arg,
                                        0,
                                        token));
 }