Multiple parallel tasks, number of tasks is not known in advance

I am working on a tool which will process big video files, splitting them into parts, and running processing in parallel on several workers. I am going to split video file into fixed length chunks.

The problem is that I do not know the length of incoming video files - they can be short, or they can be really long. So I do not know in advance number of chunks to process.

I am a newbie in BPMN. How can I draw a BPMN, that would spawn parallel blocks, while the actual number of blocks is determined in runtime?

Can you calculate amount of workers needed before you start the first one?

If so, you can use multi-instance with calculated value in loop cardinality.

You can use the multi-instance in subprocess or task.

See Task Markers | docs.camunda.org

1 Like

Thank you for pointing to multi-instance feature. Looks like this is what I need.

Can you calculate amount of workers needed before you start the first one?

I cannot know about number of workers needed before job is started, but I can calculate it in a preparation/analysis block I can add. Is this a valid approach in conjunction with multi-instance block?

Hi @grafalex,

yes, that’s the way to go.