Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 34 additions & 1 deletion docs/api-ref.md
Original file line number Diff line number Diff line change
Expand Up @@ -1316,7 +1316,6 @@ Source files: server/endpoint/jobs_endpoint.py

```py
jobs.get_by_id(job_id)

```

Gets information about the specified job.
Expand Down Expand Up @@ -1374,6 +1373,40 @@ Returns the `JobItem` requested.
```


<br>
<br>

#### jobs.wait_for_job


```py
jobs.wait_for_job(job_id, *, timeout=None)
```

Waits until a given job succesfully finishes.
Repeatedly polls the server using `jobs.get_by_id` until the job completed.
It uses an exponentially increasing sleep time between polls to guarantee a snappy response time for fast-running jobs while not putting overly large load on the server for long-running jobs.

In case the job fails or is cancelled, `wait_for_job` will raise an exception.

**Parameters**

Name | Description
:--- | :---
`job_id` | The `job_id` specifies the id of the job that we want to wait for
`timeout` | Optional timeout interval in seconds. `wait_for_job` will raise a `TimeoutError` if the job is not finished after waiting for `timeout` seconds.


**Returns**

Returns the final `JobItem`.

Usually, you can just discard the return value without checking the job status. In case the job wasn't succesful, `wait_for_job` would have already raised an exception. For advanced scenarios, he returned `JobItem` might still be interesting to access e.g. start and end time or `notes`.

**Example**

See the `update_datasource_data.py` or `refresh.py` sample in the Samples directory.

<br>
<br>

Expand Down