Skip to content

Latest commit

 

History

History
578 lines (400 loc) · 20.1 KB

JobsApi.md

File metadata and controls

578 lines (400 loc) · 20.1 KB

queueflow.JobsApi

All URIs are relative to http://localhost:8000

Method HTTP request Description
cancel_job POST /api/v1/jobs/{id}/cancel
cancel_jobs POST /api/v1/jobs/cancel
create_batch_jobs POST /api/v1/jobs/batch
create_job POST /api/v1/jobs
get_job GET /api/v1/jobs/{id}
list_jobs GET /api/v1/jobs
stream_job_events GET /api/v1/jobs/{id}/events Stream a job's status transitions as Server-Sent Events until it reaches a terminal state. Lets clients await completion without polling the REST endpoint themselves.

cancel_job

cancel_job(id)

Example

  • Bearer (API Key) Authentication (bearerAuth):
import queueflow
from queueflow.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:8000
# See configuration.py for a list of all supported configuration parameters.
configuration = queueflow.Configuration(
    host = "http://localhost:8000"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization (API Key): bearerAuth
configuration = queueflow.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with queueflow.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = queueflow.JobsApi(api_client)
    id = 'id_example' # str | Job id

    try:
        api_instance.cancel_job(id)
    except Exception as e:
        print("Exception when calling JobsApi->cancel_job: %s\n" % e)

Parameters

Name Type Description Notes
id str Job id

Return type

void (empty response body)

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
204 Cancelled -
401 Unauthorized -
403 Forbidden -
404 Not found -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

cancel_jobs

CancelJobsResponse cancel_jobs(cancel_jobs_request)

Example

  • Bearer (API Key) Authentication (bearerAuth):
import queueflow
from queueflow.models.cancel_jobs_request import CancelJobsRequest
from queueflow.models.cancel_jobs_response import CancelJobsResponse
from queueflow.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:8000
# See configuration.py for a list of all supported configuration parameters.
configuration = queueflow.Configuration(
    host = "http://localhost:8000"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization (API Key): bearerAuth
configuration = queueflow.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with queueflow.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = queueflow.JobsApi(api_client)
    cancel_jobs_request = queueflow.CancelJobsRequest() # CancelJobsRequest | 

    try:
        api_response = api_instance.cancel_jobs(cancel_jobs_request)
        print("The response of JobsApi->cancel_jobs:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling JobsApi->cancel_jobs: %s\n" % e)

Parameters

Name Type Description Notes
cancel_jobs_request CancelJobsRequest

Return type

CancelJobsResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Matching non-terminal jobs of the caller's tenant were cancelled, oldest first, up to `limit`. Repeat until `cancelled` is below `limit` to drain a large set. -
400 Invalid filter (for example a terminal status) -
401 Unauthorized -
403 Forbidden -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

create_batch_jobs

CreateBatchJobsResponse create_batch_jobs(create_batch_jobs_request)

Example

  • Bearer (API Key) Authentication (bearerAuth):
import queueflow
from queueflow.models.create_batch_jobs_request import CreateBatchJobsRequest
from queueflow.models.create_batch_jobs_response import CreateBatchJobsResponse
from queueflow.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:8000
# See configuration.py for a list of all supported configuration parameters.
configuration = queueflow.Configuration(
    host = "http://localhost:8000"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization (API Key): bearerAuth
configuration = queueflow.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with queueflow.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = queueflow.JobsApi(api_client)
    create_batch_jobs_request = queueflow.CreateBatchJobsRequest() # CreateBatchJobsRequest | 

    try:
        api_response = api_instance.create_batch_jobs(create_batch_jobs_request)
        print("The response of JobsApi->create_batch_jobs:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling JobsApi->create_batch_jobs: %s\n" % e)

Parameters

Name Type Description Notes
create_batch_jobs_request CreateBatchJobsRequest

Return type

CreateBatchJobsResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Jobs created -
400 Invalid request -
401 Unauthorized -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

create_job

CreateJobResponse create_job(create_job_request, idempotency_key=idempotency_key)

Example

  • Bearer (API Key) Authentication (bearerAuth):
import queueflow
from queueflow.models.create_job_request import CreateJobRequest
from queueflow.models.create_job_response import CreateJobResponse
from queueflow.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:8000
# See configuration.py for a list of all supported configuration parameters.
configuration = queueflow.Configuration(
    host = "http://localhost:8000"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization (API Key): bearerAuth
configuration = queueflow.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with queueflow.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = queueflow.JobsApi(api_client)
    create_job_request = queueflow.CreateJobRequest() # CreateJobRequest | 
    idempotency_key = 'idempotency_key_example' # str | Optional client-supplied key making this create idempotent per tenant: retrying with the same key returns the original job instead of creating a duplicate. (optional)

    try:
        api_response = api_instance.create_job(create_job_request, idempotency_key=idempotency_key)
        print("The response of JobsApi->create_job:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling JobsApi->create_job: %s\n" % e)

Parameters

Name Type Description Notes
create_job_request CreateJobRequest
idempotency_key str Optional client-supplied key making this create idempotent per tenant: retrying with the same key returns the original job instead of creating a duplicate. [optional]

Return type

CreateJobResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Job created (or replayed idempotently) -
400 Invalid request -
401 Unauthorized -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_job

Job get_job(id)

Example

  • Bearer (API Key) Authentication (bearerAuth):
import queueflow
from queueflow.models.job import Job
from queueflow.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:8000
# See configuration.py for a list of all supported configuration parameters.
configuration = queueflow.Configuration(
    host = "http://localhost:8000"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization (API Key): bearerAuth
configuration = queueflow.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with queueflow.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = queueflow.JobsApi(api_client)
    id = 'id_example' # str | Job id

    try:
        api_response = api_instance.get_job(id)
        print("The response of JobsApi->get_job:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling JobsApi->get_job: %s\n" % e)

Parameters

Name Type Description Notes
id str Job id

Return type

Job

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Job -
403 Forbidden -
404 Not found -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

list_jobs

ListJobsResponse list_jobs(status=status, queue=queue, task_name=task_name, replayed=replayed, limit=limit, offset=offset, order_by=order_by, include_total=include_total, cursor=cursor, created_after=created_after, created_before=created_before)

Example

  • Bearer (API Key) Authentication (bearerAuth):
import queueflow
from queueflow.models.list_jobs_response import ListJobsResponse
from queueflow.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:8000
# See configuration.py for a list of all supported configuration parameters.
configuration = queueflow.Configuration(
    host = "http://localhost:8000"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization (API Key): bearerAuth
configuration = queueflow.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with queueflow.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = queueflow.JobsApi(api_client)
    status = 'status_example' # str | Filter by status (e.g. `pending`, `completed`). (optional)
    queue = 'queue_example' # str | Filter by queue name (jobs only). (optional)
    task_name = 'task_name_example' # str | Filter by task name (jobs and dead letters). (optional)
    replayed = True # bool | Dead letters only: `false` lists entries not yet replayed, `true` the replayed ones; both when omitted. (optional)
    limit = 56 # int | Page size, 1..=100 (default 50). (optional)
    offset = 56 # int | Number of records to skip (default 0). (optional)
    order_by = 'order_by_example' # str | `created_at ASC` or `created_at DESC` (default DESC). (optional)
    include_total = True # bool | Include the exact `total` count in the response (default false; the count is an extra full scan over the filtered set). (optional)
    cursor = 'cursor_example' # str | Opaque keyset cursor from a previous page's `next_cursor`. When set, `offset` is ignored and listing continues where that page ended. (optional)
    created_after = '2013-10-20T19:20:30+01:00' # datetime | Only rows created at or after this instant (RFC 3339, inclusive). With `created_before` this forms the half-open range `[after, before)` — the natural shape for walking history period by period. (optional)
    created_before = '2013-10-20T19:20:30+01:00' # datetime | Only rows created strictly before this instant (RFC 3339, exclusive). (optional)

    try:
        api_response = api_instance.list_jobs(status=status, queue=queue, task_name=task_name, replayed=replayed, limit=limit, offset=offset, order_by=order_by, include_total=include_total, cursor=cursor, created_after=created_after, created_before=created_before)
        print("The response of JobsApi->list_jobs:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling JobsApi->list_jobs: %s\n" % e)

Parameters

Name Type Description Notes
status str Filter by status (e.g. `pending`, `completed`). [optional]
queue str Filter by queue name (jobs only). [optional]
task_name str Filter by task name (jobs and dead letters). [optional]
replayed bool Dead letters only: `false` lists entries not yet replayed, `true` the replayed ones; both when omitted. [optional]
limit int Page size, 1..=100 (default 50). [optional]
offset int Number of records to skip (default 0). [optional]
order_by str `created_at ASC` or `created_at DESC` (default DESC). [optional]
include_total bool Include the exact `total` count in the response (default false; the count is an extra full scan over the filtered set). [optional]
cursor str Opaque keyset cursor from a previous page's `next_cursor`. When set, `offset` is ignored and listing continues where that page ended. [optional]
created_after datetime Only rows created at or after this instant (RFC 3339, inclusive). With `created_before` this forms the half-open range `[after, before)` — the natural shape for walking history period by period. [optional]
created_before datetime Only rows created strictly before this instant (RFC 3339, exclusive). [optional]

Return type

ListJobsResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Page of jobs -
401 Unauthorized -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

stream_job_events

str stream_job_events(id)

Stream a job's status transitions as Server-Sent Events until it reaches a terminal state. Lets clients await completion without polling the REST endpoint themselves.

Example

  • Bearer (API Key) Authentication (bearerAuth):
import queueflow
from queueflow.rest import ApiException
from pprint import pprint

# Defining the host is optional and defaults to http://localhost:8000
# See configuration.py for a list of all supported configuration parameters.
configuration = queueflow.Configuration(
    host = "http://localhost:8000"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization (API Key): bearerAuth
configuration = queueflow.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with queueflow.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = queueflow.JobsApi(api_client)
    id = 'id_example' # str | Job id

    try:
        # Stream a job's status transitions as Server-Sent Events until it reaches a terminal state. Lets clients await completion without polling the REST endpoint themselves.
        api_response = api_instance.stream_job_events(id)
        print("The response of JobsApi->stream_job_events:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling JobsApi->stream_job_events: %s\n" % e)

Parameters

Name Type Description Notes
id str Job id

Return type

str

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: text/event-stream, application/json

HTTP response details

Status code Description Response headers
200 SSE stream; each `status` event carries the full job JSON. Closes after the job reaches a terminal state. -
401 Unauthorized -
403 Forbidden -
404 Not found -

[Back to top] [Back to API list] [Back to Model list] [Back to README]