示例#1
0
        private VertexTaskState YarnTaskStateToVertexTaskState(YarnTaskState ts)
        {
            VertexTaskState vts = VertexTaskState.NA;

            if (ts == YarnTaskState.NA)
            {
                vts = VertexTaskState.NA;
            }
            else if (ts < YarnTaskState.Running)
            {
                vts = VertexTaskState.Waiting;
            }
            else if (ts == YarnTaskState.Running)
            {
                vts = VertexTaskState.Running;
            }
            else
            {
                switch (ts)
                {
                case YarnTaskState.Completed:
                    vts = VertexTaskState.Finished;
                    break;

                case YarnTaskState.Failed:
                    vts = VertexTaskState.Failed;
                    break;
                    //case TaskState.Canceled:
                    //case TaskState.Canceling:
                    //    vts = VertexTaskState.Canceled;
                    //    break;
                }
            }
            DryadLogger.LogDebug("Task State", "Mapped ts: {0} to vts: {1}", ts, vts);
            return(vts);
        }
示例#2
0
        /// <summary>
        /// Create a new dispatcher and add to the good dispatcher pool.
        /// </summary>
        /// <param name="taskid">HPC Task Id</param>
        /// <param name="node">Name of node this dispatcher is for</param>
        /// <param name="state">State of task when dispatcher is created (always Running now)</param>
        /// <returns>Dispatcher that was added, or null if a dispatcher already exists in the good pool for specified node</returns>
        private Dispatcher AddDispatcher(int taskid, string node, VertexTaskState state)
        {
            VertexComputeNode cn = new VertexComputeNode();
            cn.instanceId = taskid;
            cn.ComputeNode = node;
            cn.State = state;
            Dispatcher d = new Dispatcher(schedulerHelper, cn);
            d.FaultedEvent += new DispatcherFaultedEventHandler(OnDispatcherFaulted);

            if (!dispatcherPool.Add(d))
            {
                // There's already a dispatcher for this node
                d.Dispose();
                d = null;
            }
            return d;
        }