locked
RunUntilCanceled when job is queued cannot be set via API, can be set via GUI RRS feed

  • Question

  • In HPC Pack 2012 R2 if I submit a job with RunUntilCanceled = true then at some point do:

    job.RunUntilCanceled = false;

    job.Commit();

    then I get 

    "Microsoft.Hpc.Scheduler.Properties.SchedulerException: The property RunUntilCanceled cannot be set when the job is in state Queued."

    But via the HPC Cluster Manager GUI I can go to Job Management and select a queued job -> right click -> Modify job -> uncheck "Run job until cancelled or runtime expires" -> "Modify" and it modifies the job as expected.

    How can I do this via the .Net API?


    • Edited by TimJRoberts1 Thursday, October 15, 2015 11:26 AM
    Thursday, October 15, 2015 11:26 AM

Answers

  • It works as expected via the CLI, so to call from C# you can do something like this:

    Process.Start(new ProcessStartInfo("job", string.Format("modify {0} /rununtilcanceled:false /scheduler:{1}", job.Id, hpcHeadnode)){CreateNoWindow = true, UseShellExecute = false}).WaitForExit();
    • Marked as answer by TimJRoberts1 Wednesday, October 21, 2015 12:11 PM
    Wednesday, October 21, 2015 10:33 AM

All replies

  • We haven't exposed the jobModify interface in the scheduler API. At this time, you can do below as we do in GUI and CLI:

    Please add reference to Microsoft.Hpc.Scheduler.Store and with below methods:

        Microsoft.Hpc.Scheduler.Store.SchedulerStoreHelpers.JobModify(ISchedulerStore store, int jobId, params StoreProperty[] changedProps)

    Qiufang


    Qiufang Shi

    Friday, October 16, 2015 3:49 AM
  • I get the same exception when calling this method.

    I call this:

    SchedulerStoreHelpers.JobModify(SchedulerStore.Connect("MyHeadNode"), job.Id, new StoreProperty("RunUntilCanceled", false));

    Here is the stacktrace

    Microsoft.Hpc.Scheduler.Properties.SchedulerException : The property RunUntilCanceled cannot be set when the job is in state Queued.

    Server stack trace: 
       at Microsoft.Hpc.Scheduler.Store.CallResult.Throw()
       at Microsoft.Hpc.Scheduler.Store.StoreServer.PostRemoteCall(CallResult cr)
       at Microsoft.Hpc.Scheduler.Store.StoreServer.Object_SetProps(ObjectType obType, Int32 obId, StoreProperty[] props)
       at Microsoft.Hpc.Scheduler.Store.SchedulerStoreSvc.SetPropsOnServer(ObjectType obType, Int32 itemId, StoreProperty[] props)
       at Microsoft.Hpc.Scheduler.Store.JobEx.SetProps(StoreProperty[] jobProperties)
       at Microsoft.Hpc.Scheduler.Store.SchedulerStoreHelpers.DirectlySetProps(IClusterJob job, StoreProperty[] changedProps, StoreProperty[] noUse)
       at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
       at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

    Exception rethrown at [0]: 
       at System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message reqMsg, Boolean bProxyCase)
       at System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed, ref MessageData msgData)
       at Microsoft.Hpc.Scheduler.Store.SchedulerStoreHelpers.JobModifyInternalDelegate.EndInvoke(IAsyncResult result)
       at Microsoft.Hpc.Scheduler.Store.AsyncResultWrapper.EndInvoke()
       at Microsoft.Hpc.Scheduler.Store.SchedulerStoreHelpers.EndJobModify(IAsyncResult result)
       at Microsoft.Hpc.Scheduler.Store.SchedulerStoreHelpers.JobModify(ISchedulerStore store, Int32 jobId, StoreProperty[] changedProps)

    However I can still go in to the GUI and uncheck "Run until job is canceled" on the job and it works as expected.

    Also I can call on the command line:

    job modify [jobid] /rununtilcanceled:false
    and it works as expected. 

    • Edited by TimJRoberts1 Wednesday, October 21, 2015 10:21 AM added command line example
    Wednesday, October 21, 2015 10:13 AM
  • It works as expected via the CLI, so to call from C# you can do something like this:

    Process.Start(new ProcessStartInfo("job", string.Format("modify {0} /rununtilcanceled:false /scheduler:{1}", job.Id, hpcHeadnode)){CreateNoWindow = true, UseShellExecute = false}).WaitForExit();
    • Marked as answer by TimJRoberts1 Wednesday, October 21, 2015 12:11 PM
    Wednesday, October 21, 2015 10:33 AM