Computations
Media DCR computations may be run as long as:
- The Media DCR collaboration type supports the given computation.
- The user has sufficient permissions to run the computation.
Running computations is a three step process:
- Call the appropriate function on the Media DCR.
- These functions will return a
ComputeJob
representing the computation.
- These functions will return a
- Wait for the
ComputeJob
to complete.- A convenience function
wait_for_completion
is provided which returns only when the job is complete or when the specified timeout is encountered. Alternatively, the user may manually poll themselves by callingis_complete
on the job.
- A convenience function
- Once complete, the result can be retrieved by calling
result
on the job.
Below is an example of this process:
overlap_statistics_job = media_dcr.get_overlap_statistics()
overlap_statistics_job.wait_for_completion(timeout=60 * 5)
overlap_statistics = overlap_statistics_job.result()
Many computations return Pydantic model object types. To convert these to native python dictionaries use the model_dump
method. For example:
overlap_statistics_dict = overlap_statistics.model_dump()