/// <summary> /// Distributes the task over HPC /// </summary> /// <param name="distributableObject">distributable task</param> public override void Distribute(IDistributable distributableObject) { this.Name = distributableObject.JobName; ClusterSubmitter.SubmitAndWait(this, distributableObject, MaxSubmitAfterTasksFail, OnSubmitted); CopyResults.AddRange(ArgumentCollection.EnumerateValuesOfTypeFromParsable <OutputFile>(distributableObject).Select(file => file.ToString()).Distinct().Where(s => s != "-")); if (CopyResults.Count > 0) { HpcLib.CopyFiles(CopyResults, ExternalRemoteDirectoryName, Environment.CurrentDirectory); } }
/// <summary> /// Refreshes job status /// </summary> public void RefreshJobStatus() { if (_jobListener != null) { LogEntry oldVersion = (LogEntry)this.MemberwiseClone(); JobState = _jobListener.JobState; ISchedulerJobCounters counters = _jobListener.JobCounters; //_job.GetCounters(); string stateStr = string.Format("{0}/{1}/{2}/{3}/{4}", counters.QueuedTaskCount, counters.RunningTaskCount, counters.FailedTaskCount, counters.CanceledTaskCount, counters.FinishedTaskCount); FailedTaskCount = counters.FailedTaskCount; TaskStatus = stateStr; if (FailedTaskCount > 0) { IEnumerable <ISchedulerTask> tasklist = ClusterSubmitter.GetFailedAndCanceledTasks(_jobListener.Scheduler, _jobListener.Job); string failedTaskRangeAsString = tasklist.Select(task => task.TaskId.JobTaskId).StringJoin(","); if ("" != failedTaskRangeAsString) { this.FailedTasks = RangeCollection.Parse(failedTaskRangeAsString).ToString(); } else { FailedTasks = ""; } } else { FailedTasks = ""; } if (_jobListener.JobState == JobState.Finished) { if (WallTime.Ticks == 0) { DateTime startTime = _job.SubmitTime; DateTime endTime = _job.EndTime; WallTime = endTime - startTime; } if (CpuTime.Ticks == 0) { var tasklist = _job.GetTaskList(null, null, true).Cast <ISchedulerTask>(); var totalTicks = tasklist.Select(task => (task.EndTime - task.StartTime).Ticks).Sum(); CpuTime = new TimeSpan(totalTicks); } } } }
/// <summary> /// Requeues all failed or canceled tasks. /// </summary> /// <returns>True if all tasks were successfully Requeued.</returns> public bool RequeueFailedTasks() { if (_job != null) { try { ClusterSubmitter.RequeueFailedAndCanceledTasks(_jobListener.Scheduler, _jobListener.Job); FailedTaskCount = 0; FailedTasks = ""; return(true); } catch { } } return(false); }
/// <summary> /// Distributes the task over HPC /// </summary> /// <param name="distributableObject">distributable tasks</param> public virtual void Distribute(IDistributable distributableObject) { this.Name = distributableObject.JobName; ClusterSubmitter.Submit(this, distributableObject); }
private void UpdateFailedTaskString(ISchedulerJob job) { IEnumerable <ISchedulerTask> tasklist = ClusterSubmitter.GetFailedAndCanceledTasks(_jobListener.Scheduler, job); this.FailedTasks = tasklist.Select(task => task.TaskId.JobTaskId).StringJoin(","); }