Skip to main content

Computations

Media DCR computations may be run as long as:

  1. The Media DCR collaboration type supports the given computation.
  2. The user has sufficient permissions to run the computation.

Running computations is a three step process:

  1. Call the appropriate function on the Media DCR.
    • These functions will return a ComputeJob representing the computation.
  2. 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 calling is_complete on the job.
  3. 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()