Working with jobs

Querying Jobs

The full list of jobs run can be obtained using get_jobs().

import qai_hub as hub

jobs = hub.get_jobs(limit=10)
print(jobs)

Given a specific job id from the UI (an ID starting with j e.g. jvgdwk7z5), the job can be programmatically queried using get_job().

import qai_hub as hub

job = hub.get_job("jvgdwk7z5")
print(job)

Profiling Jobs

The results of a profiling job can be obtained programmatically using the ProfileJob as follows:

profile = job.download_profile()
print(profile)

The output of the printed dictionary is as follows:

{
    'estimated_inference_time': 2997,
    'estimated_inference_peak_memory': 69177344,
    'first_load_time': 2162619,
    'first_load_peak_memory': 83742720,
    'warm_load_time': 123904,
    'warm_load_peak_memory': 73179136,
    'compile_time': 0,
    'compile_peak_memory': 0,
    'compile_memory_increase_range': None,
    'compile_memory_peak_range': None,
    'first_load_memory_increase_range': (0, 0),
    'first_load_memory_peak_range': (26226688, 31730736),
    'warm_load_memory_increase_range': (0, 10580480),
    'warm_load_memory_peak_range': (12865536, 37318656),
    'inference_memory_increase_range': (0, 12160),
    'inference_memory_peak_range': (12288, 21276192),
    'all_compile_times': [],
    'all_first_load_times': [2162619],
    'all_warm_load_times': [123904],
    'all_inference_times': [9130, .... ]
}

The profile dictionary can be used to obtain the latency (in ms)

latency_ms = profile["execution_summary"]["execution_time"] / 1000

Sharing Jobs

By default all jobs are only accessible to the user that created the job. Jobs can also be shared programmatically with specific accounts using the following:

job.modify_sharing(add_emails=['name@company.com'])

Permissions can also be revoked from specific accounts

job.modify_sharing(delete_emails=['name@company.com'])