Some mutating methods can return a job if requested, so you can choose to wait for completion yourself (track
method), or ignore it and let it finish in the background some time. The job always has the return_value
from the (mutating) method available -- this is the "immediately returned" value, not some result from running the actual job (look in status
and info
instead).
Usage:
# by default, the method waits for completion before returning
record = unicat.mutate.copy_record_channels_down(record, channels)
# but you can also track progress yourself
job = unicat.mutate.copy_record_channels_down(record, channels, return_job=True)
for status in job.track():
assert status == job.status
print(job.name, job.status)
record = job.return_value
# or, return quickly and let the job run unmonitored in the background
job = unicat.mutate.copy_record_channels_down(record, channels, return_job=True)
record = job.return_value
UnicatJob
properties & methodsjob.gid: gid
job.name: str
job.status: str
job.info: dict
job.created_on: timestamp | None
job.updated_on: timestamp | None
job.progress: dict # combined gid, name, status, info, and timestamps
job.return_value: Any
job.track(timeout_in_seconds: float | None = None, poll_interval_in_seconds: float = 1.0) -> Generator[str]