pyantz.api.endpoints.get_jobs package#

Submodules#

pyantz.api.endpoints.get_jobs.endpoint module#

Get the jobs as a list for the user.

NO_DESCRIPTION = 'No description available.'#

Description of jobs without a docstring.

describe_job(fn: object)[source]#

Get the first paragraph of the docstring, on one line.

Parameters:

fn (object) – the job function.

Returns:

the first paragraph of its docstring, or NO_DESCRIPTION.

Return type:

str

Raises:

None. –

Example

from pyantz.api.endpoints.get_jobs.endpoint import describe_job
from pyantz.jobs.files.simple import mkdir

print(describe_job(mkdir))
print(describe_job(lambda: None))
Create the directory, and any missing parents (it may already exist).
No description available.
get_jobs()[source]#

Get list of all the available jobs.

Parameters:

None.

Returns:

the name and description of each registered job.

Return type:

GetJobResponse

Raises:

None. –

Example

from pyantz.api.endpoints.get_jobs.endpoint import get_jobs

names = [job.name for job in get_jobs().jobs]
print("pyantz.jobs.files.simple.copy" in names)
True
router = <fastapi.routing.APIRouter object>#

Routes listing the jobs.

Parameters:
  • scope (Scope)

  • receive (Receive)

  • send (Send)

Return type:

None

pyantz.api.endpoints.get_jobs.models module#

Data models for the get_jobs endpoint.

class GetJobResponse(*, jobs: list[JobInfo])[source]#

Bases: BaseModel

Response returned by the get_job request.

Parameters:

jobs (list[JobInfo])

_abc_impl = <_abc._abc_data object>#
jobs: list[JobInfo]#

Every registered job.

class JobInfo(*, name: str, description: str)[source]#

Bases: BaseModel

A job which can be used in pyantz.

Parameters:
  • name (str)

  • description (str)

_abc_impl = <_abc._abc_data object>#
description: str#

First paragraph of the job’s docstring.

name: str#

Import path of the function, which is how configs refer to the job.

Module contents#

Return available jobs to the end user.