> ## Documentation Index
> Fetch the complete documentation index at: https://docs.paradime.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Admin client: jobs

> Follow the async jobs of the Administration API from Python with paradime.admin.jobs: read a job, wait for it to finish, and list the schedules of a deploy.

Some Administration API operations take longer than one request, so they run as jobs: connecting a git repository with the deploy key, checking repository access, deploying YAML schedules, and syncing DinoAI agents from code. The methods that start them return an `AdminJob`. `paradime.admin.jobs` reads jobs and waits for them. For the GraphQL side, see [Conventions](https://docs.paradime.io/developers/graphql-api/admin-api/conventions.md).

> [!NOTE]
>
> **Prerequisites**
>
> * These operations are available on every plan.
> * Any API key can read the jobs of its workspace. A company API key reads the jobs of the workspace it targets, so pass the same `workspace_uid` as the call that started the job.
> * The admin client of the `paradime-io` package. See [Admin client](https://docs.paradime.io/developers/python-sdk/modules/admin/index).

The examples on this page use this client:

```python theme={"system"}
from paradime import Paradime

paradime = Paradime(api_endpoint="API_ENDPOINT", api_secret="prdm_cmp_...", workspace_uid="WORKSPACE_UID")
```

| Started by | Job `kind` | `result` type |
| - | - | - |
| [`git.connect`](https://docs.paradime.io/developers/python-sdk/modules/admin/git#connect-a-repository) with the deploy key and validation | `CONNECT_GIT_REPOSITORY` | `GitRepositoryConnectResult` |
| [`git.check_repository`](https://docs.paradime.io/developers/python-sdk/modules/admin/git#check-repository-access) | `CHECK_GIT_REPOSITORY` | `GitRepositoryCheckResult` |
| [`bolt.deploy_schedules`](https://docs.paradime.io/developers/python-sdk/modules/admin/bolt#deploy-yaml-schedules) | `DEPLOY_BOLT_SCHEDULES` | `DeployBoltSchedulesResult` |
| [`dinoai.sync_agents_from_code`](https://docs.paradime.io/developers/python-sdk/modules/admin/dinoai#sync-agents-from-code) | `SYNC_DINOAI_AGENT_DEFINITIONS_FROM_CODE` | `DinoAiAgentSyncResult` |

## Wait for a job

Polls a job until it is `SUCCEEDED` or `FAILED`.

**job\_id** `str` *required*

The job's id.

**timeout** `float` (default: 600)

How many seconds to wait at most.

**poll\_interval** `float` (default: 2)

How many seconds to wait between polls.

**workspace\_uid** `Optional[str]` (default: None)

The workspace to target, for a company API key.

**Returns** `AdminJob`

The job that succeeded. Its `result` is the typed result of its `kind`.

* A job that fails raises the exception of its failure code, for example `AdminConnectionTestFailedException` when the deploy key can't push. The exception's `job` attribute is the failed job.
* A job that is not finished after `timeout` seconds raises `AdminJobTimeoutException`. Its `job` attribute is the job's last state.
* A job that the key can't see raises `AdminNotFoundException`.
* A job status that this SDK version doesn't know raises `AdminApiException`: upgrade `paradime-io`.

```python theme={"system"}
from paradime.apis.admin import AdminApiException, AdminJobTimeoutException

job = paradime.admin.bolt.deploy_schedules()
try:
    job = paradime.admin.jobs.wait(job.id, timeout=900)
    print(job.result.git_hash, job.result.schedules.total_count)
except AdminJobTimeoutException as error:
    print(f"Still {error.job.status.value}; check again later.")
except AdminApiException as error:
    print(f"The job failed: {error}")
```

## Get a job

Reads a job once, without waiting.

**job\_id** `str` *required*

The job's id, as the operation that started it returned.

**workspace\_uid** `Optional[str]` (default: None)

The workspace to target, for a company API key.

**Returns** `Optional[AdminJob]`

The job, or `None` when the key can't see a job with this id.

```python theme={"system"}
job = paradime.admin.jobs.get("JOB_ID")
if job is not None and job.is_finished:
    print(job.status, job.failure)
```

## List the schedules of a deploy

Iterates over every schedule that a deploy job read, YAML and UI, in the order the deploy stored them. The job's `result` holds only their first page.

**job\_id** `str` *required*

The id of the job that `admin.bolt.deploy_schedules` started.

**workspace\_uid** `Optional[str]` (default: None)

The workspace to target, for a company API key.

**page\_size** `int` (default: 100)

How many schedules to read per request, at most 500.

**Returns** `Iterator[DeployedBoltSchedule]`

The schedules, read one page at a time. None unless the job is a deploy that succeeded. A job that the key can't see raises `AdminNotFoundException`.

```python theme={"system"}
failed = [
    schedule
    for schedule in paradime.admin.jobs.deployed_schedules("JOB_ID")
    if schedule.failure_reason
]
for schedule in failed:
    print(schedule.slug, schedule.source, schedule.failure_reason)
```

## Types

Import the models and enums from `paradime.apis.admin.jobs.types`.

**AdminJob** `model`

**fields**

**id** `str`

The job's id.

**kind** `AdminJobKind`

The operation that started the job. It names the type of `result`.

**status** `AdminJobStatus`

`QUEUED` (waiting to start), `RUNNING`, `SUCCEEDED` or `FAILED`.

**failure** `Optional[AdminJobFailure]`

Why the job failed: its `code` (one of the [error codes](https://docs.paradime.io/developers/python-sdk/modules/admin/index#errors)) and `reason`. `None` unless `FAILED`.

**result** `Optional[model]`

What the job produced, as the result type of its `kind`. `None` unless `SUCCEEDED`.

**created\_at** `Optional[datetime]`

When the job started.

**updated\_at** `Optional[datetime]`

When the job last changed.

**is\_finished** `bool`

Whether the job is `SUCCEEDED` or `FAILED`.

**DeployBoltSchedulesResult** `model`

**fields**

**schedule\_parse\_id** `Optional[int]`

The id of the schedule parse that ran the deploy.

**git\_hash** `Optional[str]`

The commit that the YAML schedules were read from.

**schedules** `DeployedBoltSchedulePage`

The first page of the schedules the deploy read: `nodes`, `total_count`, `end_cursor` and `has_next_page`.

**DeployedBoltSchedule** `model`

**fields**

**slug** `str`

The schedule's slug.

**source** `Optional[BoltScheduleSource]`

`YAML` for a schedule in the repository, `UI` for one created in Paradime or through the API.

**failure\_reason** `Optional[str]`

Why the schedule was not deployed. `None` when it was.

**GitRepositoryConnectResult** `model`

**fields**

**uri** `str`

The repository's SSH URI.

**provider** `Optional[GitProvider]`

The service hosting the repository.

**dbt\_project\_dir** `Optional[str]`

The folder that holds `dbt_project.yml`. `None` for the repository's root.

**GitRepositoryCheckResult** `model`

**fields**

**uri** `str`

The repository's SSH URI, as checked.

**DinoAiAgentSyncResult** `model`

**fields**

**added** `Optional[int]`

How many agent definitions the sync created.

**updated** `Optional[int]`

How many existing agent definitions the sync replaced.

**skipped** `Optional[int]`

How many files under `.dinoai/agents/` the sync skipped as not valid.

**branch** `Optional[str]`

The branch the sync read.

**commit\_sha** `Optional[str]`

The commit the sync read.

**is\_fetched** `Optional[bool]`

Whether the repository was fetched from its remote first. When `False`, the sync read the commits that Paradime already had.


## Related topics

- [Admin client](https://docs.paradime.io/developers/python-sdk/modules/admin/index.md)
- [Admin client: Bolt](https://docs.paradime.io/developers/python-sdk/modules/admin/bolt.md)
- [Admin client: git repository](https://docs.paradime.io/developers/python-sdk/modules/admin/git.md)
- [Admin client: DinoAI](https://docs.paradime.io/developers/python-sdk/modules/admin/dinoai.md)
- [Admin client: notifications](https://docs.paradime.io/developers/python-sdk/modules/admin/notifications.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.