#pragma warning disable IDE0051 // Remove unused private members private static void SubmitNewJob() { #pragma warning restore IDE0051 // Remove unused private members NewJobSubmitter newJobSubmitter = new NewJobSubmitter { Command = "batch.py", UserStandardOutputFileName = "stdout.txt", TargetOperatingSystem = TargetOperatingSystem.ANY }; JobDescriptor jobDescriptor = newJobSubmitter.SubmitNewJob(); Log("Job submitted"); jobDescriptor.JobStartedEvent.WaitOne(); Log("Job started"); jobDescriptor.JobCompletedEvent.WaitOne(); Log("Job completed"); }
/// <summary> /// Submits new instance of currently executing applicaiton. /// </summary> /// <returns>job descriptor bound to newly created job</returns> public JobDescriptor Submit() { var descriptor = NewJobSubmitter.SubmitNewJob(); activeGlobalJobDescriptors.Add(descriptor); descriptor.AddCustomStateListener((previous, current, jobId) => { switch (current) { case JobState.REMOVED: case JobState.COMPLETED: case JobState.HELD: activeGlobalJobDescriptors?.Remove(descriptor); break; } }); return(descriptor); }