Run python on specified task completion

Hey,

I am just wondering if there is a way to run a piece of code on the completion of a specific task as specified by Job ID and Task ID. I am aware of the on JobPostTaskScript but this is a generic change for all tasks in a job and not just specific ones.

Cheers,
Stephen

Hello

Thanks for reaching out. There isn’t a built-in way to do that. The script will attach to every task. The way to workaround might be to have a little condition like if (something about this task): do the thing at the top of the task script.

Hi,
Thanks for the reply. The problem I’m trying to solve is: disabling a child worker (using CPU/GPU affinities to “split” one worker into two less powerful ones) on a generic job, so I don’t think that specifics about the job will work. It’s intended so that its parent worker (the fusion of two child workers) can then be used to run a job that requires more resources. Is there a better way to achieve this? It’s a bit backwards as I have to select a parent to run the job then disable the children so I can enable the parent, rather than it offering itself up. I should be able to achieve a similar thing through setting the extra job information with specific information about the machine to disable, and using the post task script to read it back.
Cheers and thanks,
Stephen