Manage Task Dependency with Python API

General discussions and questions.
Post Reply
carlo.giesa
Posts: 21
Joined: Thu May 20, 2021 2:59 pm

Manage Task Dependency with Python API

Post by carlo.giesa »

Hi there!

I'm wondering how we can manage task dependencies with the Python API. The only thing that I found so far is the `tasks_depend_mask` property on the block object. But I'm not sure how that should be used and how I can control dependencies between specific tasks this way.

My idea is to create my own way to encode tasks and create whatever kind of dependencies between them to end up with the most efficient setup. Tasks might not always depend on frame numbers and I would also like to support a more flexible frame range support.

Would that be possible?

Greets,
Carlo
User avatar
timurhai
Site Admin
Posts: 913
Joined: Sun Jan 15, 2017 8:40 pm
Location: Russia, Korolev
Contact:

Re: Manage Task Dependency with Python API

Post by timurhai »

Hello!
For now you can't say some specific task to wait some other specific task.
Only block can depend any other block, if block has tasks depend mask, its tasks will depend other block tash by frame settings.
It can be implemented, but it is not so easy to do this.
For example each task (if block it not numeric, of cource) can have some array of integers, that represent block and task numbers to wait.

But in most cases tasks_depend_mask is enough.
Can you give an example, when it is not?
Timur Hairulin
CGRU 3.3.1, Ubuntu 20.04, 22.04, MS Windows 10 (clients only).
carlo.giesa
Posts: 21
Joined: Thu May 20, 2021 2:59 pm

Re: Manage Task Dependency with Python API

Post by carlo.giesa »

Thanks for your feedback!

I'm not sure how to use 'tasks_depend_mask'. Could you give me an example for this?

If CGRU is only managing task dependency based on frame settings that do only allow start, end and step, we reach quickly limits. As a simple example, I would like to run jobs that render first, middle and last frame of a shot and run a post render procedure right afterwards. Having only start, end, step, does not allow me to define a first, middle, last frame for any kind of shot duration.

And then, we can use tasks to run on other things than frames that you would like to be task dependent on other tasks with the same type of work item.

I used Tractor in my last company where execution order can be defined on a task level which was really handy.
carlo.giesa
Posts: 21
Joined: Thu May 20, 2021 2:59 pm

Re: Manage Task Dependency with Python API

Post by carlo.giesa »

I have another question: Is it possible to control the status of block that way, so that I can control when it should start?

This question relates to a situation where I have tasks that are not running on CGRU. And I have tasks on CGRU that depend on those tasks. So I would like to control on my side when a block starts its work. And this could go in both directions. I could have tasks that are not running on CGRU being dependent on CGRU blocks.
User avatar
timurhai
Site Admin
Posts: 913
Joined: Sun Jan 15, 2017 8:40 pm
Location: Russia, Korolev
Contact:

Re: Manage Task Dependency with Python API

Post by timurhai »

Hello!
I see. There can be various situations where tasks dependency can solve the problem.
In a feature release there will be some "suspend" state for task and block, for manual start control.
For now you can control block "suspend" state by setting its maximum running tasks to zero.
Timur Hairulin
CGRU 3.3.1, Ubuntu 20.04, 22.04, MS Windows 10 (clients only).
carlo.giesa
Posts: 21
Joined: Thu May 20, 2021 2:59 pm

Re: Manage Task Dependency with Python API

Post by carlo.giesa »

That sounds great. When would that be available?
And do you have an idea if providing access to custom task dependencies could be available in a near future?
User avatar
timurhai
Site Admin
Posts: 913
Joined: Sun Jan 15, 2017 8:40 pm
Location: Russia, Korolev
Contact:

Re: Manage Task Dependency with Python API

Post by timurhai »

Hello!
Not in the near feature.
May be in a year, or so.
Timur Hairulin
CGRU 3.3.1, Ubuntu 20.04, 22.04, MS Windows 10 (clients only).
carlo.giesa
Posts: 21
Joined: Thu May 20, 2021 2:59 pm

Re: Manage Task Dependency with Python API

Post by carlo.giesa »

Alright! Thanks for the info!
Post Reply