Job polling (reportnet_api.jobs)
Generated by
scripts/generate_docs.py(scripts/regen_docs.sh). Do not edit by hand.
Hand-written helpers in reportnet_api.jobs. They are plain functions, not methods of a resource, and make no endpoint of their own: the ReportNet rights needed are those of the underlying API calls (see the resource pages).
Functions
- async_wait_for_job
- download_url_of
- import_statistics_changed
- job_id_of
- polling_url_of
- progress_event
- progress_scope
- wait_for_job
async_wait_for_job
Async twin of wait_for_job().
Call: jobs.async_wait_for_job(...)
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
client |
AsyncReportnetClient |
yes | ||
job |
dict[str, Any] \| str |
yes | ||
poll_interval |
float |
no | 2.0 |
|
timeout |
float |
no | 300.0 |
Returns: dict[str, Any]
download_url_of
The downloadUrl of a finished export job.
Call: jobs.download_url_of(...)
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
answer |
dict[str, Any] |
yes |
Returns: str
import_statistics_changed
True if get_import_related_statistics() shows a new import since before.
Call: jobs.import_statistics_changed(...)
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
before |
dict[str, Any] |
yes | ||
after |
dict[str, Any] |
yes | ||
table_schema_id |
str \| None |
no | None |
Returns: bool
The answer maps table schema id -> {"lastImportDate", "numberOfRecordsImported",
"fileExtension"}. An import counts as visible once a table's
(lastImportDate, numberOfRecordsImported) pair differs from the baseline (or
the table is new); comparing the pair, not the count alone, also catches a
re-import that leaves the count unchanged. With table_schema_id only that
table is checked, otherwise any table.
job_id_of
The job id of a job-start answer: its jobId, else parsed from the pollingUrl.
Call: jobs.job_id_of(...)
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
job |
dict[str, Any] \| str |
yes |
Returns: str | None
polling_url_of
The pollingUrl of a job-start answer (or the string itself).
Call: jobs.polling_url_of(...)
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
job |
dict[str, Any] \| str |
yes |
Returns: str
progress_event
The dict a progress callback receives.
Call: jobs.progress_event(...)
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
kind |
str |
yes | ||
status |
str \| None |
no | None |
|
elapsed |
float |
yes | ||
job_id |
str \| None |
no | None |
|
page |
int \| None |
no | None |
|
rows |
int \| None |
no | None |
Returns: ProgressEvent
kind is "job" (one poll of an Orchestrator job; status is its
status), "file" (waiting for an export file to appear), "confirm"
(import finished, checking the statistics) or "page" (read_tables
fetched page page, rows rows so far). Keys not relevant to a kind are None.
progress_scope
Resolve a progress argument to a callback (or None) for the duration of a wait.
Call: jobs.progress_scope(...)
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
progress |
Progress |
yes |
Returns: Iterator[Callable[[ProgressEvent], None] | None]
True makes a ProgressPrinter and ends its line on exit; a callable is
passed through untouched, so a helper can resolve once and hand the result to
the helpers it calls.
wait_for_job
Poll a job's pollingUrl until FINISHED and return the last answer.
Call: jobs.wait_for_job(...)
| Argument | Type | Required | Default | Description |
|---|---|---|---|---|
client |
ReportnetClient |
yes | ||
job |
dict[str, Any] \| str |
yes | ||
poll_interval |
float |
no | 2.0 |
|
timeout |
float |
no | 300.0 |
|
progress |
Progress |
no | None |
Returns: dict[str, Any]
job is the dict a job-starting method returned (or its pollingUrl).
Raises JobError on a failure status, an error answer, or after
timeout seconds. progress=True shows one updating status line; a
callable receives an event dict per poll (see progress_event()). With
progress on, Ctrl-C prints the job id and that the job keeps running.
Live-tested notes:
- Mocked tests, plus live runs of the v4/v5 exports and
import_big_file_datajobs; whether v3downloadUrlbehaves like v4's is unverified. Thedevelopbackend has nopollForJobStatus(only theMasterDataLakesbranch was read).