How to tell if a SOA job is cancelled programatically after the submit? RRS feed

  • General discussion

  • I have a C# app which is kicking off a SOA job with multiple tasks within that job.  I'd like to detect the case where the overall job was cancelled by the user (and exit gracefully) vs. all the other failure cases (some tasks failed, connection issues, etc).

    Is there a way to do this?  What i've done is kicked off a job with 10 tasks, and normally I'd expect to get 10 responses back with whether the task return for each:

                        foreach (var response in client.GetResponses<RunPCResponse>())
                                if (response.Result.RunPCResult != 0) //this means failure.
                            catch (Exception ex) //also catch any exceptions and write to the console.

    What I'm seeing when I cancel is that there is only 1 response returned, with a somewhat generic Result value of "

    - Result 'response.Result' threw an exception of type 'Microsoft.Hpc.Scheduler.Session.SessionException' SimRunner.DriverHPCParallelService.RunPCResponse {Microsoft.Hpc.Scheduler.Session.SessionException}

    + base {"Session is failed or canceled. Please refer to the reason of the session's job for more information."} System.Exception {Microsoft.Hpc.Scheduler.Session.SessionException}

    which gives canceled as an option, but seems like it could also have broken for other reasons and gotten teh same message.

    Is there a way of getting the job status to definitively tell if the job was canceled vs. failed for other reasons?



    Thursday, September 17, 2015 3:34 PM

All replies

  • Hi Jason,

    If the SOA job is cancelled by the user, the SOA job would have the final job state Canceled and with the Error Message: Canceled during execution: <Msg>.

    If the SOA job finished successfully, the SOA job would have the final job state Finished with no error message. If there is certain error happens which leads to the fault responses, the SOA job could be in Finished state as well, however you may check the job's NumberOfCalls/NumberOfOutstandingCalls/Progress to decide if all requests have been processed correctly.


    Yutong Sun

    Friday, September 18, 2015 8:37 AM