airflow_client.client.JobApi

All URIs are relative to http://localhost

MethodHTTP requestDescription
get_jobsGET /api/v2/jobsGet Jobs

get_jobs

JobCollectionResponse get_jobs(is_alive=is_alive, start_date_gte=start_date_gte, start_date_gt=start_date_gt, start_date_lte=start_date_lte, start_date_lt=start_date_lt, end_date_gte=end_date_gte, end_date_gt=end_date_gt, end_date_lte=end_date_lte, end_date_lt=end_date_lt, limit=limit, offset=offset, order_by=order_by, job_state=job_state, job_type=job_type, hostname=hostname, executor_class=executor_class)

Get Jobs

Get all jobs.

Example

  • OAuth Authentication (OAuth2PasswordBearer):
  • Bearer Authentication (HTTPBearer):
import airflow_client.client
from airflow_client.client.models.job_collection_response import JobCollectionResponse
from airflow_client.client.rest import ApiException
from pprint import pprint

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

# 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.

configuration.access_token = os.environ["ACCESS_TOKEN"]

# Configure Bearer authorization: HTTPBearer
configuration = airflow_client.client.Configuration(
    access_token = os.environ["BEARER_TOKEN"]
)

# Enter a context with an instance of the API client
with airflow_client.client.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = airflow_client.client.JobApi(api_client)
    is_alive = True # bool |  (optional)
    start_date_gte = '2013-10-20T19:20:30+01:00' # datetime |  (optional)
    start_date_gt = '2013-10-20T19:20:30+01:00' # datetime |  (optional)
    start_date_lte = '2013-10-20T19:20:30+01:00' # datetime |  (optional)
    start_date_lt = '2013-10-20T19:20:30+01:00' # datetime |  (optional)
    end_date_gte = '2013-10-20T19:20:30+01:00' # datetime |  (optional)
    end_date_gt = '2013-10-20T19:20:30+01:00' # datetime |  (optional)
    end_date_lte = '2013-10-20T19:20:30+01:00' # datetime |  (optional)
    end_date_lt = '2013-10-20T19:20:30+01:00' # datetime |  (optional)
    limit = 50 # int |  (optional) (default to 50)
    offset = 0 # int |  (optional) (default to 0)
    order_by = [id] # List[str] |  (optional) (default to [id])
    job_state = 'job_state_example' # str |  (optional)
    job_type = 'job_type_example' # str |  (optional)
    hostname = 'hostname_example' # str |  (optional)
    executor_class = 'executor_class_example' # str |  (optional)

    try:
        # Get Jobs
        api_response = api_instance.get_jobs(is_alive=is_alive, start_date_gte=start_date_gte, start_date_gt=start_date_gt, start_date_lte=start_date_lte, start_date_lt=start_date_lt, end_date_gte=end_date_gte, end_date_gt=end_date_gt, end_date_lte=end_date_lte, end_date_lt=end_date_lt, limit=limit, offset=offset, order_by=order_by, job_state=job_state, job_type=job_type, hostname=hostname, executor_class=executor_class)
        print("The response of JobApi->get_jobs:\n")
        pprint(api_response)
    except Exception as e:
        print("Exception when calling JobApi->get_jobs: %s\n" % e)

Parameters

NameTypeDescriptionNotes
is_alivebool[optional]
start_date_gtedatetime[optional]
start_date_gtdatetime[optional]
start_date_ltedatetime[optional]
start_date_ltdatetime[optional]
end_date_gtedatetime[optional]
end_date_gtdatetime[optional]
end_date_ltedatetime[optional]
end_date_ltdatetime[optional]
limitint[optional] [default to 50]
offsetint[optional] [default to 0]
order_byList[str][optional] [default to [id]]
job_statestr[optional]
job_typestr[optional]
hostnamestr[optional]
executor_classstr[optional]

Return type

JobCollectionResponse

Authorization

OAuth2PasswordBearer, HTTPBearer

HTTP request headers

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

HTTP response details

Status codeDescriptionResponse headers
200Successful Response-
400Bad Request-
401Unauthorized-
403Forbidden-
422Validation Error-

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