locked
How are tasks killed when you cancel a job? RRS feed

  • Question

  • Hi,

    I have a long running process (run as a task inside a job submitted to the scheduler) that installs some signal handlers (I know that windows doesn't have signals like POSIX does, but I am using Python, which abstracts this in a way that make sense).  These signal handlers make sure the process cleans up after itself.  When I run my process by hand from a regular cmd.exe session, the signal handlers get called when I do Control-C.  But, when the process is running on a compute node as a task and I stop the process using "Cancel Job", the task exits without the signal handlers being called.  This leaves a huge mess each time the process runs that I have to clean up.

    So, questions:

    * How exactly does the scheduler stop processes on compute nodes?
    * Can this be changed, to basically mimic what a Control-C does (this is like a SIGINT on POSIX).

    Cheers,

    Brian
    Sunday, November 8, 2009 10:36 PM

Answers

  • The scheduler actually just cleans up the job object, so it's more the equivalent of selecting your process(es) in Task Manager and hitting "kill process."

    In v3 (Beta 1 of which will soon be available at http://connect.microsoft.com!) we provide a new feature called "Task Cancellation Grace Period" where we will send your task a CTRL+BREAK signal and then give it X seconds to clean-up.

    Thanks,
    Josh


    -Josh
    Monday, November 16, 2009 9:06 PM
    Moderator