Skip to content

Working with the count subrequest operator

UbiOps pipelines come with some predefined operators that you can use. One of those operators is the count subrequests operator. This operator is almost always used together with the create subrequests operator. As the name suggests this operator counts the number of subrequests.

You can add this operator to your pipeline with the UbiOps Client Library by providing the following parameters:

Field Description
name count-many
reference name count-many
reference type operator
configuration (example) {
"input_fields": [],
"output_fields": [{"name":"output", "data_type":"int"}]

Configuring the count subrequest operator

The output of the count subrequest operator depends on where you put it. If you want the operator to count all the subrequests that are made in your pipeline, you should place it directly after the object:

The position of the count subrequest operator determines what it returns. Lets say you have a pipeline like the one described in the create subrequests howto, where a pipeline is configured to process a video frame by frame in parallel and contains three objects: - an object hat splits a video in frames - an object that processes each individual frame - an object that puts the frames back together

If the operator is placed directly after the create subrequest operator, the number of subrequest within each batch is returned. So if the videos has 500 frames and you put the batch size to 100, the count subrequests will return 5 times an output of 100. It can be useful to use this operator if you do not know beforehand how many subrequests you will have in total, as in this case the last batch is often not completely filled. If we happen to have a video of 460 frames for instance, our count subrequests operator would then return 4 times an output of 100 and one time an output of 60.


If the operator is placed after an object, the number of subrequests that that object returns in the form of a list are counted. So if there is an object that splits the video in 500 frames, the output of the operator would be 500.


That's all there is to this operator. If you run into any issues though, do not hesitate to contact support.