provenaclient.modules.job_service

Created Date: Monday June 17th 2024 +1000 Author: Peter Baker —– Last Modified: Monday June 17th 2024 4:45:39 pm +1000 Modified By: Peter Baker —– Description: Job API L3 Module. Includes Job Admin sub module. —– HISTORY: Date By Comments ———- — ———————————————————

Classes

JobAdminSubService

This class interface just captures that the client has an instantiated auth

JobService

This class interface just captures that the client has an instantiated auth

Module Contents

class provenaclient.modules.job_service.JobAdminSubService(auth: provenaclient.modules.module_helpers.AuthManager, config: provenaclient.modules.module_helpers.Config, job_api_client: provenaclient.clients.JobAPIClient)[source]

Bases: provenaclient.modules.module_helpers.ModuleService

This class interface just captures that the client has an instantiated auth manager which allows for helper functions abstracted for L3 clients.

_job_api_client: provenaclient.clients.JobAPIClient
_auth
_config
async launch_job(request: ProvenaInterfaces.AsyncJobAPI.AdminLaunchJobRequest) ProvenaInterfaces.AsyncJobAPI.AdminLaunchJobResponse[source]

Launches a new job.

Parameters:

request (AdminLaunchJobRequest) – Specified job parameters

Returns:

The response

Return type:

AdminLaunchJobResponse

async get_job(session_id: str) ProvenaInterfaces.AsyncJobAPI.AdminGetJobResponse[source]

Fetches a job (any job since admin)

Parameters:

session_id (str) – The session ID of job to fetch

Returns:

The response

Return type:

AdminGetJobResponse

async list_jobs(list_jobs_request: ProvenaInterfaces.AsyncJobAPI.AdminListJobsRequest) ProvenaInterfaces.AsyncJobAPI.AdminListJobsResponse[source]

Lists all jobs.

Parameters:

list_jobs_request (AdminListJobsRequest) – The request including pagination information.

Returns:

The list of jobs response.

Return type:

AdminListJobsResponse

async list_all_jobs(list_jobs_request: ProvenaInterfaces.AsyncJobAPI.AdminListJobsRequest, limit: ProvenaInterfaces.AsyncJobAPI.Optional[int] = None) List[ProvenaInterfaces.AsyncJobAPI.JobStatusTable][source]

Lists all jobs for the given user.

Will automatically paginate until list is exhausted.

Parameters:
  • list_jobs_request (AdminListJobsRequest) – The request including details

  • limit (Optional[int]) – Total record limit to enforce, if any

Returns:

The list of jobs

Return type:

ListJobsResponse

async for_all_jobs(list_jobs_request: ProvenaInterfaces.AsyncJobAPI.AdminListJobsRequest, limit: ProvenaInterfaces.AsyncJobAPI.Optional[int] = None) AsyncGenerator[ProvenaInterfaces.AsyncJobAPI.JobStatusTable, None][source]

Lists all jobs for the given user.

Returns lazy generator for use in for loops.

Will automatically paginate until list is exhausted.

Parameters:
  • list_jobs_request (AdminListJobsRequest) – The request including details

  • limit (Optional[int]) – Total record limit to enforce, if any

Returns:

The list of jobs

Return type:

ListJobsResponse

async list_job_batch(list_request: ProvenaInterfaces.AsyncJobAPI.AdminListByBatchRequest) ProvenaInterfaces.AsyncJobAPI.AdminListByBatchResponse[source]

List jobs by batch ID, returning a list of jobs in the batch.

Parameters:

list_request (AdminListByBatchRequest) – The request including batch ID

Returns:

The list of jobs in the batch

Return type:

AdminListByBatchResponse

async list_all_jobs_in_batch(list_request: ProvenaInterfaces.AsyncJobAPI.AdminListByBatchRequest, limit: ProvenaInterfaces.AsyncJobAPI.Optional[int] = None) List[ProvenaInterfaces.AsyncJobAPI.JobStatusTable][source]

Lists all jobs for the given user. Will automatically paginate all entries to exhaust list

NOTE this could return more than limit - but figure it may as well return data fetched for efficiency reasons

Parameters:
  • list_jobs_request (AdminListJobsRequest) – The request including details

  • limit (Optional[int]) – Total record limit to enforce, if any

Returns:

The list of jobs

Return type:

ListJobsResponse

async for_all_jobs_in_batch(list_request: ProvenaInterfaces.AsyncJobAPI.AdminListByBatchRequest, limit: ProvenaInterfaces.AsyncJobAPI.Optional[int] = None) AsyncGenerator[ProvenaInterfaces.AsyncJobAPI.JobStatusTable, None][source]

Lists all jobs for the given user. Will automatically paginate all entries to exhaust list

NOTE this could return more than limit - but figure it may as well return data fetched for efficiency reasons

Parameters:
  • list_jobs_request (AdminListJobsRequest) – The request including details

  • limit (Optional[int]) – Total record limit to enforce, if any

Returns:

The list of jobs

Return type:

ListJobsResponse

class provenaclient.modules.job_service.JobService(auth: provenaclient.modules.module_helpers.AuthManager, config: provenaclient.modules.module_helpers.Config, job_api_client: provenaclient.clients.JobAPIClient)[source]

Bases: provenaclient.modules.module_helpers.ModuleService

This class interface just captures that the client has an instantiated auth manager which allows for helper functions abstracted for L3 clients.

_job_api_client: provenaclient.clients.JobAPIClient
admin: JobAdminSubService
_auth
_config
async get_health_check() provenaclient.models.HealthCheckResponse[source]

Health check the API

Returns:

Response

Return type:

HealthCheckResponse

async fetch_job(session_id: str) ProvenaInterfaces.AsyncJobAPI.GetJobResponse[source]

Fetches a job by session id

Parameters:

session_id (str) – The session ID

Returns:

The job fetched

Return type:

GetJobResponse

async list_jobs(list_jobs_request: ProvenaInterfaces.AsyncJobAPI.ListJobsRequest) ProvenaInterfaces.AsyncJobAPI.ListJobsResponse[source]

Lists all jobs for the given user

Can return pagination if page size exceeded

Parameters:

list_jobs_request (ListJobsRequest) – The request including details

Returns:

The list of jobs

Return type:

ListJobsResponse

async list_all_jobs(list_jobs_request: ProvenaInterfaces.AsyncJobAPI.ListJobsRequest, limit: ProvenaInterfaces.AsyncJobAPI.Optional[int] = None) List[ProvenaInterfaces.AsyncJobAPI.JobStatusTable][source]

Lists all jobs for the given user.

Will automatically paginate until list is exhausted.

Parameters:
  • list_jobs_request (ListJobsRequest) – The request including details

  • limit (Optional[int]) – Total record limit to enforce, if any

Returns:

The list of jobs

Return type:

ListJobsResponse

async for_all_jobs(list_jobs_request: ProvenaInterfaces.AsyncJobAPI.ListJobsRequest, limit: ProvenaInterfaces.AsyncJobAPI.Optional[int] = None) AsyncGenerator[ProvenaInterfaces.AsyncJobAPI.JobStatusTable, None][source]

Lists all jobs for the given user.

Returns lazy generator for use in for loops.

Will automatically paginate until list is exhausted.

Parameters:
  • list_jobs_request (ListJobsRequest) – The request including details

  • limit (Optional[int]) – Total record limit to enforce, if any

Returns:

The list of jobs

Return type:

ListJobsResponse

async list_jobs_in_batch(list_request: ProvenaInterfaces.AsyncJobAPI.ListByBatchRequest) ProvenaInterfaces.AsyncJobAPI.ListByBatchResponse[source]

Gets all jobs within a batch.

Can return pagination if page size exceeded

Parameters:

list_request (ListByBatchRequest) – The request including batch ID

Returns:

The response including list of jobs

Return type:

ListByBatchResponse

async list_all_jobs_in_batch(list_request: ProvenaInterfaces.AsyncJobAPI.ListByBatchRequest, limit: ProvenaInterfaces.AsyncJobAPI.Optional[int] = None) List[ProvenaInterfaces.AsyncJobAPI.JobStatusTable][source]

Lists all jobs for the given user. Will automatically paginate all entries to exhaust list

NOTE this could return more than limit - but figure it may as well return data fetched for efficiency reasons

Parameters:
  • list_jobs_request (ListJobsRequest) – The request including details

  • limit (Optional[int]) – Total record limit to enforce, if any

Returns:

The list of jobs

Return type:

ListJobsResponse

async for_all_jobs_in_batch(list_request: ProvenaInterfaces.AsyncJobAPI.ListByBatchRequest, limit: ProvenaInterfaces.AsyncJobAPI.Optional[int] = None) AsyncGenerator[ProvenaInterfaces.AsyncJobAPI.JobStatusTable, None][source]

Lists all jobs for the given user. Will automatically paginate all entries to exhaust list

NOTE this could return more than limit - but figure it may as well return data fetched for efficiency reasons

Parameters:
  • list_jobs_request (ListJobsRequest) – The request including details

  • limit (Optional[int]) – Total record limit to enforce, if any

Returns:

The list of jobs

Return type:

ListJobsResponse

async await_job_completion(session_id: str, settings: provenaclient.models.AsyncAwaitSettings = DEFAULT_AWAIT_SETTINGS) ProvenaInterfaces.AsyncJobAPI.JobStatusTable[source]

Awaits completion of a given job then provides the job info.

Completion is defined as a job status which is not pending or in progress.

Parameters:

session_id (str) – The ID of the job to monitor and await completion.

Returns:

The entry at the latest point.

Return type:

JobStatusTable

async await_successful_job_completion(session_id: str, settings: provenaclient.models.AsyncAwaitSettings = DEFAULT_AWAIT_SETTINGS) ProvenaInterfaces.AsyncJobAPI.JobStatusTable[source]

Awaits successful completion of a given job then provides the job info.

Completion is defined as a job status which is not pending or in progress.

Parameters:

session_id (str) – The ID of the job to monitor and await completion.

Returns:

The entry at the latest point.

Return type:

JobStatusTable