locked
how to run an exe/bat file on "Job Completion" for a SOA job RRS feed

  • Question

  • Is there a way for me to trigger an exe or a bat file on job completion (finished/cancelled/etc)...

    I am looking for something similar to "releaseNodecommand" but at a job level.

    thanks!

    Saturday, July 9, 2016 4:33 AM

All replies

  • Hi, SRIRAM,

      Currently there is no built-in ways for you to do this. You shall implement your own logics on your client or headnode to monitor job status change (OnCompletion job event) and then trigger your own logics there.

      We do have a similar request in our product to do list. And if you could help provide your usage scenario, we may be able to better prioritize the work items. And for your scenario, do you want:

    - Whether the exe/bat file being executed under "job's runas account"? Or under admin's account?

    - What behavior are you expected when this task (We call this job release task) failed?

    - Whether this task should be triggered when job failed?


    Qiufang Shi

    Monday, July 11, 2016 4:22 AM
  • for my scenario:

    - Whether the exe/bat file being executed under "job's runas account"? Or under admin's account?

    it would be user account for now; but i can see a need for something to be run under admin account. (make both available as two different job release tasks, maybe? eg.,  jobReleaseCommandUser and jobReleaseCommandAdmin)

    - What behavior are you expected when this task (We call this job release task) failed?

    send an email notification to admin and/or user (see my answer below)

    - Whether this task should be triggered when job failed?

    yes. that would be useful. if the job state can be made available to the task (failed/cancelled/finished/etc) via an environment variable, i can perform custom logic in my code based on the state.

    in my case, i'd like to check  to see if all tasks were run successfully or if there was an error (after the job enters finished/failed state). if there were errors in multiple tasks, then pull the message details for that task,get exception details, and then create an email summary and send it to the user. today the user gets 'n' emails if 'n' tasks have some issues in them (although job is in finished state). i'd like to consolidate all of them into one email instead of admin or the user having to open up job manager -> soa jobs -> message details -> navigate through each of those messages on left pane and see if the right pane has any errors!

    secondly, i'd like to rerun a failed task automatically when the job is finished(ideally, would like to re-run automatically before job is finished) - eg., a node (laptop) on which a task in running could be disconnected from network (or)  a node could stop running a task due to 'time policy' template applied to it etc.

    Monday, July 11, 2016 4:16 PM
  • Thanks SRIRAM. I think you're asking two features.

    1. Job Release task, this will be executed under job's credential. And this job will always be executed before the job going to final state (Failed/Finished/Cancelled). The task will get the potential job state. And we would like this task to be run on the last resource the job holds before release (In case the task never being able to executed).

    2. Job Finish Filter, this will be executed under admin's account.

    For your second point (to rerun a failed task automatically, I think this is already available in our system). And there is a new feature we added in our this QFE (https://www.microsoft.com/en-us/download/details.aspx?id=50809): SOA multi-emit.


    Qiufang Shi

    Tuesday, July 12, 2016 7:19 AM
  • Great.  Makes sense.

    Need a bit more info in "Job Finish Filter" - Is it expected to run only after the job is in Finished state ? or will it run even if the job goes into canceled/failed states?

    do you anticipate these features in the next update of hpc pack 2012 r2 or could they possibly be in hpc pack 2016 or beyond or would they be in a qfe?

    Tuesday, July 12, 2016 11:45 AM