Hi, is there a way to query the status of all the task rendered?
I have this preScript that execute at every task in the mayabatch plugin. I would need to to something when the task being rendered is the first task to be rendered, if it is not the the first task then I need to skip this.
Would there be a way to do this?
Is this script supposed to be executed during the very first task of the job, or during the first task of the job that is rendered on a specific machine (ie: machine A gets task 0, machine B gets task 1, and each machine needs to execute the script because their task is the first task they are rendering for the job)? If it’s the latter case, you could probably do something in the StartJob() function in the plugin because that function only gets called when the job is initially started on a machine. For example, you could set a variable like FirstTask to True, then after an iteration of RenderTasks(), you could set FirstTask to False at the end.
Cheers,
This is a special case job. When I render using Irradiance map with vray, my submitter submit 2 jobs, one creating the irradiance map, the other job reading the map and rendering.
For the irradiance map job, I force a machine limit of 1 so that only 1 machine at a time can render a task…so that I don’t get the problem of 2 machines writing the irradiance map at the same time thus creating a wrong irradiance map. The script I call for those job, reads the irradiance map and set the render setting values accordingly. But when it is the very first task I need to skip the irradiance map read, because A, the map may not exists (I still have exception to make sure the code don’t fail if the map exists) or B the map may exists but is coming from a previous render and should be overwritten.
That’s why I need to know the status of all the tasks. Doing this code in the startJob() function, the script might be called many time if the machine start rendering the job, stop reendering this job to render a higher priority job, then coming back to the original job, the startJob() function would get called again, run the script and skip the irradiance map read. This would result in a wrong map.
Thanks
You might be able to use DeadlineCommand to query the job:
deadlinecommand getjob 999_050_000_28a82795
You should be able to get the job ID in the plugin by calling
SlaveUtils.GetCurrentJobValue( "JobID" )
You can then parse the output for these lines:
TaskCount=1
TasksQueued=0
TasksRendering=0
TasksSuspended=1
TasksCompleted=0
TasksFailed=0
From that, you should be able to figure out if this is the first task.
Cheers,
is there a way to call deadlinecommand from the plugin py file?
You should be able to use .NET’s Process class in the System.Diagnostics namespace:
msdn.microsoft.com/en-us/library … ocess.aspx
You can then use the Process’ StdoutOutput property to read in the stdout:
msdn.microsoft.com/en-us/library … utput.aspx
Hope that helps!