A post job script wouldn’t run until the entire job was completed in all it’s tasks. We’ll have to do some investigating here to figure out why it’s not returning the expected data.
After a bit more post task script testing I’ve found that JobQueuedTasks and JobCompletedTasks give the correct output immediately after a job is started or resumed, but then they remain the same even as subsequent tasks are completed.
Is this because the args provided to the post task script are provided when a job is started or resumed and then not updated in between tasks? And if this is the case, is there any way to query how many tasks are left from a post task script?
Yup, the plugin’s GetJob function doesn’t get the ‘latest’ state of the Job, it just returns the cached value it got when it first de-queued the Job.
To get the latest value you can use the RepositoryUtils.GetJob fuction (docs here). Make sure to pass in ‘True’ as the second argument, or you’ll just get the cached value back again