static string generateTaskLogLine(ISchedulerTask task) { /* * #Timestamp JobTask State TaskName AllocatedNodes StartTime EndTime ElapsedTimeSec ExitCode ErrorMessage Output WorkingDirectory Command * 26/01/2012 14:50:29 8149.1 Failed Task no. 29 LOGSCAPEHPC04 26/01/2012 14:50:29 26/01/2012 14:50:29 0 1 NULL NULL NULL @I am a useless app */ DateTime logDateStamp = new DateTime(); string jobTaskId = string.Format("{0}.{1}", task.ParentJobId, task.TaskId); TimeSpan duration = task.EndTime - task.StartTime; List <string> nodes = new List <string>(task.AllocatedNodes); string allocatedNodes = string.Join(" ", nodes.ToArray()); string logline = string.Format("{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}\t{8}\t{9}\t{10}\t{11}\t{12}", logDateStamp.ToString(hpcDateTimeFormat), task.TaskId, task.State, task.Name, allocatedNodes, task.StartTime, task.EndTime, duration, task.ExitCode, task.ErrorMessage, task.Output, task.WorkDirectory + "_", task.CommandLine); logline = logline.Replace("\t\t", "\tNULL"); logline = logline + "\n" + "Changetime:" + task.ChangeTime; List <string> columns = new List <string>() { "Timestamp", "TaskId", "State", "Name", "AllocatedNodes", "StartTime", "EndTime", "ElapsedTimeSec", "ExitCode", "ErrorMessage", "Output", "WorkingDirectory", "CommandLine" }; logline = mapToString(makeDictionary(task), columns, "\t"); return(logline); }
protected virtual void OnTaskSubmitted(object sender, ISchedulerTask task) { if (TaskSubmitted != null) { TaskSubmitted(sender, new SchedulerTaskEventArgs(task)); } }
/// <summary> /// Schedules a task to be executed at the specified due time. /// </summary> /// <param name="dueTime">Absolute time at which to execute the task.</param> /// <param name="task">The task to execute.</param> /// <param name="scheduler">The scheduler to execute the task on.</param> /// <returns>A scheduled work item.</returns> public override IWorkItem <TAbsolute> ScheduleAbsolute(TAbsolute dueTime, ISchedulerTask task, IScheduler scheduler) { if (task == null) { throw new ArgumentNullException(nameof(task)); } if (scheduler == null) { throw new ArgumentNullException(nameof(scheduler)); } var item = new WorkItemBase <TAbsolute>(scheduler, task, dueTime, Disposable.Empty); item.RecalculatePriority(); if (item.IsRunnable) { _ready.Enqueue(item); } else { _notReady.Add(item); } return(item); }
/// <summary> /// Initializes a new instance of the <see cref="WorkItemBase{TTime}" /> class. /// </summary> /// <param name="scheduler">The logical scheduler that owns the work item.</param> /// <param name="task">The task to execute.</param> /// <param name="dueTime">The due time at which to execute the task.</param> /// <param name="onCompleted">Resource to dispose when the task has finished executing.</param> public WorkItemBase(IScheduler scheduler, ISchedulerTask task, TTime dueTime, IDisposable onCompleted) { Scheduler = scheduler ?? throw new ArgumentNullException(nameof(scheduler)); Task = task ?? throw new ArgumentNullException(nameof(task)); DueTime = dueTime; _onCompleted = onCompleted ?? throw new ArgumentNullException(nameof(onCompleted)); }
static Dictionary <string, string> makeDictionary(ISchedulerJob job, ISchedulerTask task) { Dictionary <string, string> taskDict = new Dictionary <string, string>(); List <string> nodes = new List <string>(task.AllocatedNodes); string allocatedNodes = string.Join(" ", nodes.ToArray()); //taskDict["AllocatedCoreIds"] = task.AllocatedCoreIds; taskDict["AllocatedNodes"] = allocatedNodes; taskDict["ChangeTime"] = task.ChangeTime.ToString(hpcDateTimeFormat); taskDict["CommandLine"] = task.CommandLine; taskDict["CreateTime"] = task.CreateTime.ToString(hpcDateTimeFormat); //taskDict["DependsOn"] = task.DependsOn; taskDict["EndTime"] = task.EndTime.ToString(hpcDateTimeFormat); //taskDict["EndValue"] = task.EndValue; //taskDict["EnvironmentVariables"] = task.EnvironmentVariables; taskDict["ErrorMessage"] = task.ErrorMessage; taskDict["ExitCode"] = "" + task.ExitCode; taskDict["MaximumNumberOfCores"] = "" + task.MaximumNumberOfCores; taskDict["MaximumNumberOfNodes"] = "" + task.MaximumNumberOfNodes; taskDict["MaximumNumberOfSockets"] = "" + task.MaximumNumberOfSockets; taskDict["MinimumNumberOfCores"] = "" + task.MinimumNumberOfCores; taskDict["MinimumNumberOfNodes"] = "" + task.MinimumNumberOfNodes; taskDict["MinimumNumberOfSockets"] = "" + task.MinimumNumberOfSockets; taskDict["Name"] = task.Name; taskDict["Output"] = task.Output; taskDict["ParentJobId"] = "" + task.ParentJobId; taskDict["PreviousState"] = "" + task.PreviousState; taskDict["RequeueCount"] = "" + task.RequeueCount; taskDict["RequiredNodes"] = "" + task.RequiredNodes; taskDict["StartTime"] = task.StartTime.ToString(hpcDateTimeFormat); taskDict["StartValue"] = "" + task.StartValue; taskDict["State"] = "" + task.State; taskDict["StdErrFilePath"] = task.StdErrFilePath; taskDict["StdInFilePath"] = task.StdInFilePath; taskDict["StdOutFilePath"] = task.StdOutFilePath; taskDict["TaskId"] = "" + task.TaskId; taskDict["WorkDirectory"] = task.WorkDirectory; List <string> groups = new List <string>(job.NodeGroups.ToArray()); string nodeGroups = "[" + string.Join(",", groups.ToArray()) + "]"; taskDict["NodeGroups"] = nodeGroups; if (task.EndTime < new DateTime(1970, 1, 1)) { taskDict["ElapsedTimeSec"] = "" + (DateTime.Now - task.StartTime).Milliseconds; } else { taskDict["ElapsedTimeSec"] = "" + (task.EndTime - task.StartTime).Milliseconds; } taskDict["Timestamp"] = DateTime.Now.ToString(hpcDateTimeFormat); //taskDict["ElapsedTimeSec"] = "" + (task.EndTime - task.StartTime).Milliseconds; return(taskDict); }
/// <summary> /// The job template that you specify for the job defines the initial default values and constraints for many of the job properties. /// Any changes that you make to properties must be made within the constraints of the template. /// </summary> /// <param name="jobName">the name of job</param> /// <param name="commandLine">the command line for the task</param> /// <param name="username">the name of the runas user, in the form domain\username</param> /// <param name="password">the password for the runas user</param> public void CreateJob(string jobName, string commandLine, string username, string password) { ISchedulerJob job = null; ISchedulerTask task = null; manualReset.Reset(); //create job job = _scheduler.CreateJob(); job.Name = jobName; //create task task = job.CreateTask(); task.CommandLine = commandLine; //add task to job job.AddTask(task); //specify the events that you want to receive job.OnJobState += OnJobStateCallback; job.OnTaskState += OnTaskStateCallback; //start the job _scheduler.SubmitJob(job, username, password); //block so the events get delivered manualReset.WaitOne(); }
public void AddTask(ISchedulerTask task) { lock (m_lock) { this.tasklist.Add(task); } }
/// <summary> /// Get instance from job id /// </summary> /// <param name="clustername">cluster name</param> /// <param name="jobID">job id</param> /// <returns></returns> public static LogEntry GetInstanceFromJobID(string clustername, int jobID) { LogEntry entry = new LogEntry(); entry.ClusterArgs = new ClusterSubmitterArgs(); entry.ClusterArgs.Cluster = clustername; entry.ClusterArgs.JobID = jobID; JobListener.TryConnect(clustername, jobID, null, out entry._jobListener).Enforce("Unable to recover job {0} from cluster {1}.", jobID, clustername); //entry.Connect(); //entry._job = entry.GetJob(); //entry.ClusterArgs.Name = entry._job.Name; entry.Date = entry._jobListener.Job.SubmitTime; ISchedulerTask exampleTask = entry._jobListener.Job.GetTaskList(null, null, true).Cast <ISchedulerTask>().First(); entry.ClusterArgs.StdErrDirName = exampleTask.StdErrFilePath; entry.ClusterArgs.StdOutDirName = exampleTask.StdOutFilePath; entry.ClusterArgs.Dir = exampleTask.WorkDirectory; string clusterPath = entry.ClusterDir.ToLower(); string rootClusterPath = Path.Combine(HpcLibSettings.KnownClusters[entry.Cluster].StoragePath, "username"); string relativeDir = clusterPath.Replace(rootClusterPath.ToLower(), ""); if (!relativeDir.StartsWith("\\")) { relativeDir = "\\" + relativeDir; } entry.LocalDir = @"d:\projects" + relativeDir; return(entry); }
/// <summary> /// Submit the job to the Microsoft HPC server. /// </summary> public override object Submit(Job myJob) { string PrjName = InteractiveShell.WorkflowMgm.CurrentProject; ISchedulerJob job = null; ISchedulerTask task = null; // Create a job and add a task to the job. job = m_scheduler.CreateJob(); job.Name = myJob.Name; job.Project = PrjName; job.MaximumNumberOfCores = myJob.NumberOfMPIProcs; job.MinimumNumberOfCores = myJob.NumberOfMPIProcs; job.UserName = m_Username; task = job.CreateTask(); task.MaximumNumberOfCores = myJob.NumberOfMPIProcs; task.MinimumNumberOfCores = myJob.NumberOfMPIProcs; task.WorkDirectory = myJob.DeploymentDirectory; using (var str = new StringWriter()) { str.Write("mpiexec "); str.Write(Path.GetFileName(myJob.EntryAssembly.Location)); foreach (string arg in myJob.CommandLineArguments) { str.Write(" "); str.Write(arg); } task.CommandLine = str.ToString(); } foreach (var kv in myJob.EnvironmentVars) { string name = kv.Key; string valu = kv.Value; task.SetEnvironmentVariable(name, valu); } task.StdOutFilePath = Path.Combine(myJob.DeploymentDirectory, "stdout.txt"); task.StdErrFilePath = Path.Combine(myJob.DeploymentDirectory, "stderr.txt"); if (m_ComputeNodes != null) { foreach (string node in m_ComputeNodes) { job.RequestedNodes.Add(node); } } job.AddTask(task); // Start the job. m_scheduler.SubmitJob(job, m_Password != null ? m_Username : null, m_Password); return(job.Id); }
static void Main(string[] args) { Console.Write("hpc: "); string serverName = Console.ReadLine(); Console.Write("user: "******"job template (<Enter> - 'default'): "); string jobTemplate = Console.ReadLine(); if (string.IsNullOrWhiteSpace(jobTemplate)) { jobTemplate = "Default"; } IScheduler scheduler = new Scheduler(); scheduler.Connect(serverName); ISchedulerJob job = scheduler.CreateJob(); job.SetJobTemplate(jobTemplate); ISchedulerTask task = job.CreateTask(); task.CommandLine = "dir"; job.AddTask(task); // Specify the events that you want to receive. job.OnJobState += JobStateCallback; job.OnTaskState += TaskStateCallback; // Start the job. scheduler.SubmitJob(job, user, null); manualEvent.WaitOne(); }
public _(IObserver <TResult> observer) { _observer = observer; _queue = new List <TResult>(); _task = new YieldableItemProcessingTask(this); _eventBuffer = new TResult[16]; }
public void HandleEnqueueJobCommandEventStoreSavesJob() { // Arrange List <ISchedulerTask> tasks = new List <ISchedulerTask>(); ISchedulerTask task = MockRepository.GenerateMock <ISchedulerTask>(); tasks.Add(task); EnqueueJob command = new EnqueueJob(Guid.NewGuid(), tasks); // Act schedulerJobCommandHandlers.Handle(command); // Assert eventStore.AssertWasCalled(x => x.SaveEvents( Arg <Guid> .Matches(s => s.Equals(command.JobId)), Arg <IEnumerable <Event> > .Matches(s => s.Count() == 1 && ((JobCreated)s.ElementAt(0)).JobId.Equals(command.JobId) && ((JobCreated)s.ElementAt(0)).Tasks.Equals(tasks)), Arg <int> .Matches(s => s == 1) )); }
/// <summary> /// Verifies whether all configured converter streams for the specified task are ready. /// </summary> /// <param name="task">The task to check the converter streams for.</param> /// <returns><c>true</c> if all converter streams, required by the task, are ready;<c>false</c> otherwise.</returns> private bool VerifyTaskConverterStreams(ISchedulerTask task) { bool isConverterStreamReady = false; var converterStreamList = _taskConverterStreams[task]; var configuredConverterStreamList = _taskConverterStreamConfig[task]; foreach (var converterStreamID in configuredConverterStreamList) { isConverterStreamReady = false; foreach (var converterStream in converterStreamList) { if (converterStream.ConverterID == converterStreamID) { isConverterStreamReady = true; break; } } if (isConverterStreamReady == false) { return false; } } return true; }
public void HandleDisableJobCommandEventStoreSavesJob() { // Arrange List <ISchedulerTask> tasks = new List <ISchedulerTask>(); ISchedulerTask task = MockRepository.GenerateMock <ISchedulerTask>(); tasks.Add(task); DisableJob command = new DisableJob(Guid.NewGuid()); List <Event> events = new List <Event>(); eventStore.Stub(x => x.GetEventsForAggregate(command.JobId)).Return(new List <Event>() { new JobCreated(command.JobId, tasks) }); // Act schedulerJobCommandHandlers.Handle(command); // Assert eventStore.AssertWasCalled(x => x.SaveEvents( Arg <Guid> .Matches(s => s.Equals(command.JobId)), Arg <IEnumerable <Event> > .Matches(s => s.Count() == 1 && ((JobDisabled)s.ElementAt(0)).JobId.Equals(command.JobId)), Arg <int> .Matches(s => s == 2) )); }
protected virtual void OnTaskSubmitted(object sender, ISchedulerTask task) { if (TaskSubmitted != null) { TaskSubmitted(sender, new SchedulerTaskEventArgs(task)); } }
/// <summary> /// a parametric sweep is a parallel computing job that consists of running multiple iterations of same command using different input values and output files /// each occurrence of an asterisk found on the command line is replaced with the value /// </summary> /// <param name="jobName">the name of job</param> /// <param name="commandLine">a parametric command for the task</param> /// <param name="startValue">the starting instance value. the value must be > 0, inclusive</param> /// <param name="endValue">the ending value. >= startValue. inclusive</param> /// <param name="incrementValue">the increment value</param> /// <param name="username">the name of the runas user, in the form domain\username</param> /// <param name="password">the password for the runas user</param> public void CreateParametricJob(string jobName, string commandLine, int startValue, int endValue, int incrementValue, string username, string password) { ISchedulerJob job = null; ISchedulerTask task = null; manualReset.Reset(); //create a job job = _scheduler.CreateJob(); job.OnJobState += OnJobStateCallback; job.OnTaskState += OnTaskStateCallback; job.Name = jobName; task = job.CreateTask(); //each occurrence of an asterisk found on the command line is replaced with the value task.CommandLine = commandLine; task.Type = TaskType.ParametricSweep; task.StartValue = startValue; task.EndValue = endValue; task.IncrementValue = incrementValue; job.AddTask(task); _scheduler.SubmitJob(job, username, password); manualReset.WaitOne(); }
protected virtual IEnumerable<String> BuildLogEntryFields(SchedulerEngineBase engine, TaskLogEntryType type, ISchedulerTask task, DateTime taskStartedOn, String additionalInfo) { yield return DateTime.Now.ToString("s"); yield return engine.Name; yield return type.ToString(); yield return task.GetType().Name; yield return (DateTime.Now - taskStartedOn).ToString(); yield return WrapAsCsvValue(additionalInfo); }
private static bool submit_job(IScheduler scheduler, string taskName, string workDir, List <string> requestedNodes, string userName, string password, bool waitFlag, string taskSuffix = "") { try { ISchedulerJob job = null; ISchedulerTask task = null; Console.WriteLine(" working dir: " + workDir); Console.WriteLine(" task: " + taskName); foreach (string node in requestedNodes) { job = scheduler.CreateJob(); job.UnitType = JobUnitType.Node; job.IsExclusive = true; StringCollection nodes = new StringCollection() { node }; Console.WriteLine(" node: " + node); job.RequestedNodes = nodes; job.Name = node + taskSuffix; task = job.CreateTask(); task.CommandLine = taskName; task.WorkDirectory = workDir; task.StdOutFilePath = workDir + "\\output.txt"; task.StdErrFilePath = workDir + "\\error.txt"; task.Name = node; job.AddTask(task); scheduler.SubmitJob(job, userName, password); } //if (waitFlag) //{ // Console.WriteLine("Waiting for job to finish..."); // while (job.State != JobState.Finished) // { // System.Threading.Thread.Sleep(5000); // } //} if (waitFlag) { Console.WriteLine("hit any key to continue"); Console.ReadKey(); } //manualEvent.WaitOne(); return(true); } catch (Exception e) { Console.WriteLine("unable to start job successfully: " + taskName); Console.WriteLine(e); return(false); } }
private void Handle(TaskLockedUntilUpdated evt) { ISchedulerTask task = Tasks.SingleOrDefault(t => t.Id == evt.TaskId); if (task != null) { task.Apply(evt); } }
public bool CanExecuted(ISchedulerTask task) { if(_timeIteration == null) { return false; } return _timeIteration.HasCome(task); }
public bool CanExecuted(ISchedulerTask task) { if (_triggers == null) { return false; } return _triggers.All(trigger => trigger.CanExecuted(task)); }
public bool HasCome(ISchedulerTask task) { if(_wasExecuted) { return false; } return (_timeProvider.GetCurrentDate() >= _executeTime); }
public ScheduledTaskWrapper(ISchedulerTask businessTask) { if (businessTask == null) { throw new ArgumentNullException("businessTask"); } this.Task = businessTask; this.NextPlannedRunTime = CalculateNextRunTime(); }
public void Handle(TaskContentUpdated evt) { ISchedulerTask task = Tasks.SingleOrDefault(t => t.Id == evt.TaskId); if (task != null) { task.Apply(evt); } }
public bool CanExecuted(ISchedulerTask task) { if(!_firstExecutedDate.HasValue) { _firstExecutedDate = task.ExecutedDate; return true; } return (_firstExecutedDate == task.ExecutedDate); }
public void AddTask(ISchedulerTask task) { if (tasks.ContainsKey(task)) { log.Warn($"Skipped attemt to add task that is already scheduled: {task.Name}"); return; } var timer = new Timer((e) => ExecuteAndReschedule(task), null, TimeSpan.Zero, Timeout.InfiniteTimeSpan); tasks.Add(task, timer); log.Info($"Scheduled task {task.Name} with interval {task.Interval}"); }
private void Run() { while (this.running) { ISchedulerTask task = this.scheduler.GetTask(); if (task != null) { task.Process(); } Thread.Sleep(3); } }
private void task_StatusChanged(ISchedulerTask task) { this.Status = task.Status; if (this.Status == eShedulerTaskStatus.Completed || this.Status == eShedulerTaskStatus.Error) { this.Resource = m_task.Resource; if (this.OnLoadComplete != null) { this.OnLoadComplete(this); } } }
public ISchedulerTask GetTask() { ISchedulerTask task = null; lock (m_lock) { if (tasklist.Count > 0) { task = tasklist[0]; tasklist.RemoveAt(0); } } return(task); }
public void RemoveTask(ISchedulerTask task) { if (!tasks.ContainsKey(task)) { log.Error($"Unable to find taks to remove: {task.Name}"); return; } WaitUntilCompleted(new List <Timer> { tasks[task] }); tasks.Remove(task); log.Info($"Task removed {task.Name}"); }
public void ExecuteWait(IEnumerable <string> tasksCmdLines, int jobMinimumNumberOfCores = 1, int jobMaximumNumberOfCores = 1, int taskMinimumNumberOfCores = 1, int taskMaximumNumberOfCores = 1, string outFolder = "") { ISchedulerJob job = null; ISchedulerTask task = null; using (IScheduler scheduler = new Scheduler( )) { scheduler.Connect(headNodeName); job = scheduler.CreateJob( ); int i = 0; foreach (var taskDef in tasksCmdLines) { i++; task = job.CreateTask( ); task.CommandLine = taskDef; task.MinimumNumberOfCores = taskMinimumNumberOfCores; task.MaximumNumberOfCores = taskMaximumNumberOfCores; task.StdOutFilePath = createOutFileName(outFolder, "stdout", i); task.StdErrFilePath = createOutFileName(outFolder, "stderr", i); job.AddTask(task); } try { job.AutoCalculateMin = false; job.AutoCalculateMax = false; job.MinimumNumberOfCores = jobMinimumNumberOfCores; job.MaximumNumberOfCores = jobMaximumNumberOfCores; job.OnJobState += new EventHandler <JobStateEventArg>(jobStateCallback); job.OnTaskState += new EventHandler <TaskStateEventArg>(taskStateCallback); // Start the job. scheduler.SubmitJob(job, string.Empty, null); // Blocks so the events get delivered. One of your event // handlers need to set this event. manualEvent.WaitOne( ); } finally { job.OnJobState -= jobStateCallback; job.OnTaskState -= taskStateCallback; } } }
public bool ShouldProcessTask(ISchedulerTask task, DateTime dateTimeToCheck, bool forMonitoring = false) { var recurringTask = (RecurringTask)task; var nearestStartDate = RecurringStartCalculatorFactory.Create(recurringTask).GetNearestStartDateBeforeSpecifiedDate(dateTimeToCheck); if (!nearestStartDate.HasValue) { return(false); } var comparison = GetTaskRange(recurringTask).CompareRangeTo(dateTimeToCheck); var nearestComparisonToShowArticle = GetNearestComparison(recurringTask, dateTimeToCheck); return(nearestComparisonToShowArticle == 0 || nearestComparisonToShowArticle > 0 && comparison >= 0); }
static void Main(string[] args) { IScheduler scheduler = new Scheduler(); string clustername = null; string username = null; if (args.Length != 2) { Console.Error.WriteLine("Usage: Finish clustername username "); return; } clustername = args[0]; username = args[1]; scheduler.Connect(clustername); ISchedulerJob job = scheduler.CreateJob(); job.UnitType = JobUnitType.Core; job.MinimumNumberOfCores = 1; job.MaximumNumberOfCores = 1; scheduler.AddJob(job); ISchedulerTask task = job.CreateTask(); task.CommandLine = @"ping -t localhost"; job.AddTask(task); scheduler.SubmitJob(job, username, null); Console.WriteLine("job {0} Submitted ", job.Id); Thread.Sleep(12 * 1000); job.Refresh(); Console.WriteLine("Job {0} State {1}", job.Id, job.State); ((ISchedulerJobV3)job).Finish(); Thread.Sleep(10000); job.Refresh(); task.Refresh(); Console.WriteLine("After finish Job {0} State {1} message {2}", job.Id, job.State, task.Output); }
private static void OnTaskStateCallback(object sender, TaskStateEventArg args) { if (TaskState.Finished == args.NewState || TaskState.Failed == args.NewState || TaskState.Canceled == args.NewState) { try { IScheduler scheduler = (IScheduler)sender; ISchedulerJob job = scheduler.OpenJob(args.JobId); ISchedulerTask task = job.OpenTask(args.TaskId); } catch (Exception) { } } }
private void SetResources(ISchedulerTask task, string locality) { if (locality == "Socket") { task.MinimumNumberOfSockets = 1; task.MaximumNumberOfSockets = 1; } else if (locality == "Core") { task.MinimumNumberOfCores = 1; task.MaximumNumberOfCores = 1; } else if (locality == "Node") { task.MinimumNumberOfNodes = 1; task.MaximumNumberOfNodes = 1; } }
public bool ShouldProcessTask(ISchedulerTask task, DateTime dateTimeToCheck, bool forMonitoring = false) { var result = dateTimeToCheck >= ((PublishingTask)task).PublishingDateTime; var pubTask = ((PublishingTask)task); if (!result && !forMonitoring) { Logger.Info() .Message( "Article [{id}] has been skipped for processing on customer code: {customerCode}." + " {currentDateTime} < {publishingDateTime}. ", pubTask.ArticleId, _customer.CustomerName, dateTimeToCheck, pubTask.PublishingDateTime) .Write(); } return(result); }
public void LogTaskMessage(SchedulerEngineBase engine, TaskLogEntryType type, ISchedulerTask task, DateTime taskStartedOn, String additionalInfo) { if (!this.ShouldLog(type)) { return; } var values = BuildLogEntryFields(engine, type, task, taskStartedOn, additionalInfo); var entry = String.Join(", ", values); WriteSchedulerMessage(type, PolishMessage(entry)); }
public void Submit(ISchedulerTask task) { OnTaskSubmitted(this, task); }
private void SetResources(ISchedulerTask task, string locality) { if (locality == "Socket") { task.MinimumNumberOfSockets = 1; task.MaximumNumberOfSockets = 1; } else if (locality == "Core") { task.MinimumNumberOfCores = 1; task.MaximumNumberOfCores = 1; } else if (locality == "Node") { task.MinimumNumberOfNodes = 1; task.MaximumNumberOfNodes = 1; } }
private static void SelectClusterNodes(ClusterEnvironment clusterEnv, ISchedulerJob job, ISchedulerTask[] tasks) { foreach (var node in clusterEnv.SelectedNodes) { foreach (var task in tasks) { if (ShouldSetTaskParameters(task)) { task.RequiredNodes.Add(node); } } } switch (clusterEnv.ScheduleProcessPer) { case ScheduleProcessPer.Socket: job.MinimumNumberOfSockets = job.MaximumNumberOfSockets = clusterEnv.NumberOfProcesses; foreach (var task in tasks) { if (ShouldSetTaskParameters(task)) { task.MinimumNumberOfSockets = task.MaximumNumberOfSockets = clusterEnv.NumberOfProcesses; } } break; case ScheduleProcessPer.Node: job.MinimumNumberOfNodes = job.MaximumNumberOfNodes = clusterEnv.NumberOfProcesses; foreach (var task in tasks) { if (ShouldSetTaskParameters(task)) { task.MinimumNumberOfNodes = task.MaximumNumberOfNodes = clusterEnv.NumberOfProcesses; } } break; case ScheduleProcessPer.Core: job.MinimumNumberOfCores = job.MaximumNumberOfCores = clusterEnv.NumberOfProcesses; foreach (var task in tasks) { if (ShouldSetTaskParameters(task)) { task.MinimumNumberOfCores = task.MaximumNumberOfCores = clusterEnv.NumberOfProcesses; } } break; } }
private static bool ShouldSetTaskParameters(ISchedulerTask task) { return task.Type != TaskType.NodePrep && task.Type != TaskType.NodeRelease; }
/// <summary> /// Create a HpcJob according to the inner task and job. /// </summary> /// <param name="taskIn">The inner task.</param> /// <param name="jobIn">The inner job.</param> /// <returns>The HpcJob.</returns> public static TtsHpcTaskJob CreateFromInnerJob(ISchedulerTask taskIn, ISchedulerJob jobIn) { TtsHpcTaskJob job = new TtsHpcTaskJob(); job.Id = taskIn.TaskId.JobTaskId; job.Name = taskIn.Name; job.State = TtsHpcTaskJob.ConvertState(taskIn.State); if (taskIn.AllocatedNodes != null && taskIn.AllocatedNodes.Count > 0) { job.Machine = taskIn.AllocatedNodes[0]; } job.Command = taskIn.CommandLine; job.LogFile = taskIn.StdOutFilePath; job.CpuTime = job.CpuTime; job.Priority = (HpcJobPriority)jobIn.Priority; return job; }
/// <summary> /// Initialize a job after it is submited. /// </summary> /// <param name="task">The submited task.</param> internal void InitializeFrom(ISchedulerTask task) { this.Id = task.TaskId.JobTaskId; this.State = ConvertState(task.State); }
public void Submit(ISchedulerTask task) { taskRequestQueue.Submit(task); OnTaskSubmitted(this, task); }
public override void Respond(ISchedulerTask task) { base.Respond(task); }
public SchedulerTaskEventArgs(ISchedulerTask task) { this.Task = task; }
public void Respond(ISchedulerTask task) { taskResponseQueue.Respond(task); }
public ScheduledTaskWrapper(ISchedulerTask businessTask) { if (businessTask == null) { throw new ArgumentNullException("businessTask"); } this.Task = businessTask; this.NextPlannedRunTime = CalculateNextRunTime(); }
public virtual void Respond(ISchedulerTask task) { OnTaskResponded(this, new SchedulerTaskEventArgs(task)); }
public bool HasCome(ISchedulerTask task) { var lastExecutionInterval = _timeProvider.GetCurrentDate() - task.ExecutedDate; return lastExecutionInterval >= _interval; }