All URIs are relative to http://localhost/api/v1
Method | HTTP request | Description |
---|---|---|
get_dag | GET /dags/{dag_id} | Get basic information about a DAG |
get_dag_details | GET /dags/{dag_id}/details | Get a simplified representation of DAG |
get_dag_source | GET /dagSources/{file_token} | Get a source code |
get_dags | GET /dags | List DAGs |
get_task | GET /dags/{dag_id}/tasks/{task_id} | Get simplified representation of a task |
get_tasks | GET /dags/{dag_id}/tasks | Get tasks for DAG |
patch_dag | PATCH /dags/{dag_id} | Update a DAG |
post_clear_task_instances | POST /dags/{dag_id}/clearTaskInstances | Clear a set of task instances |
post_set_task_instances_state | POST /dags/{dag_id}/updateTaskInstancesState | Set a state of task instances |
DAG get_dag(dag_id)
Get basic information about a DAG
Presents only information available in database (DAGModel). If you need detailed information, consider using GET /dags/{dag_id}/details.
import time import airflow_client.client from airflow_client.client.api import dag_api from airflow_client.client.model.dag import DAG from airflow_client.client.model.error import Error from pprint import pprint # Defining the host is optional and defaults to http://localhost/api/v1 # See configuration.py for a list of all supported configuration parameters. configuration = client.Configuration( host = "http://localhost/api/v1" ) # 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 HTTP basic authorization: Basic configuration = client.Configuration( username = 'YOUR_USERNAME', password = 'YOUR_PASSWORD' ) # Enter a context with an instance of the API client with client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = dag_api.DAGApi(api_client) dag_id = "dag_id_example" # str | The DAG ID. # example passing only required values which don't have defaults set try: # Get basic information about a DAG api_response = api_instance.get_dag(dag_id) pprint(api_response) except client.ApiException as e: print("Exception when calling DAGApi->get_dag: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
dag_id | str | The DAG ID. |
Status code | Description | Response headers |
---|---|---|
200 | Success. | - |
401 | Request not authenticated due to missing, invalid, authentication info. | - |
403 | Client does not have sufficient permission. | - |
404 | A specified resource is not found. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
DAGDetail get_dag_details(dag_id)
Get a simplified representation of DAG
The response contains many DAG attributes, so the response can be large. If possible, consider using GET /dags/{dag_id}.
import time import airflow_client.client from airflow_client.client.api import dag_api from airflow_client.client.model.dag_detail import DAGDetail from airflow_client.client.model.error import Error from pprint import pprint # Defining the host is optional and defaults to http://localhost/api/v1 # See configuration.py for a list of all supported configuration parameters. configuration = client.Configuration( host = "http://localhost/api/v1" ) # 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 HTTP basic authorization: Basic configuration = client.Configuration( username = 'YOUR_USERNAME', password = 'YOUR_PASSWORD' ) # Enter a context with an instance of the API client with client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = dag_api.DAGApi(api_client) dag_id = "dag_id_example" # str | The DAG ID. # example passing only required values which don't have defaults set try: # Get a simplified representation of DAG api_response = api_instance.get_dag_details(dag_id) pprint(api_response) except client.ApiException as e: print("Exception when calling DAGApi->get_dag_details: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
dag_id | str | The DAG ID. |
Status code | Description | Response headers |
---|---|---|
200 | Success. | - |
401 | Request not authenticated due to missing, invalid, authentication info. | - |
403 | Client does not have sufficient permission. | - |
404 | A specified resource is not found. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
InlineResponse2001 get_dag_source(file_token)
Get a source code
Get a source code using file token.
import time import airflow_client.client from airflow_client.client.api import dag_api from airflow_client.client.model.inline_response2001 import InlineResponse2001 from airflow_client.client.model.error import Error from pprint import pprint # Defining the host is optional and defaults to http://localhost/api/v1 # See configuration.py for a list of all supported configuration parameters. configuration = client.Configuration( host = "http://localhost/api/v1" ) # 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 HTTP basic authorization: Basic configuration = client.Configuration( username = 'YOUR_USERNAME', password = 'YOUR_PASSWORD' ) # Enter a context with an instance of the API client with client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = dag_api.DAGApi(api_client) file_token = "file_token_example" # str | The key containing the encrypted path to the file. Encryption and decryption take place only on the server. This prevents the client from reading an non-DAG file. This also ensures API extensibility, because the format of encrypted data may change. # example passing only required values which don't have defaults set try: # Get a source code api_response = api_instance.get_dag_source(file_token) pprint(api_response) except client.ApiException as e: print("Exception when calling DAGApi->get_dag_source: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
file_token | str | The key containing the encrypted path to the file. Encryption and decryption take place only on the server. This prevents the client from reading an non-DAG file. This also ensures API extensibility, because the format of encrypted data may change. |
Status code | Description | Response headers |
---|---|---|
200 | Success. | - |
401 | Request not authenticated due to missing, invalid, authentication info. | - |
403 | Client does not have sufficient permission. | - |
404 | A specified resource is not found. | - |
406 | A specified Accept header is not allowed. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
object get_dags()
List DAGs
import time import airflow_client.client from airflow_client.client.api import dag_api from airflow_client.client.model.error import Error from pprint import pprint # Defining the host is optional and defaults to http://localhost/api/v1 # See configuration.py for a list of all supported configuration parameters. configuration = client.Configuration( host = "http://localhost/api/v1" ) # 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 HTTP basic authorization: Basic configuration = client.Configuration( username = 'YOUR_USERNAME', password = 'YOUR_PASSWORD' ) # Enter a context with an instance of the API client with client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = dag_api.DAGApi(api_client) limit = 100 # int | The numbers of items to return. (optional) if omitted the server will use the default value of 100 offset = 0 # int | The number of items to skip before starting to collect the result set. (optional) # example passing only required values which don't have defaults set # and optional values try: # List DAGs api_response = api_instance.get_dags(limit=limit, offset=offset) pprint(api_response) except client.ApiException as e: print("Exception when calling DAGApi->get_dags: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
limit | int | The numbers of items to return. | [optional] if omitted the server will use the default value of 100 |
offset | int | The number of items to skip before starting to collect the result set. | [optional] |
object
Status code | Description | Response headers |
---|---|---|
200 | Success. | - |
401 | Request not authenticated due to missing, invalid, authentication info. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
Task get_task(dag_id, task_id)
Get simplified representation of a task
import time import airflow_client.client from airflow_client.client.api import dag_api from airflow_client.client.model.task import Task from airflow_client.client.model.error import Error from pprint import pprint # Defining the host is optional and defaults to http://localhost/api/v1 # See configuration.py for a list of all supported configuration parameters. configuration = client.Configuration( host = "http://localhost/api/v1" ) # 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 HTTP basic authorization: Basic configuration = client.Configuration( username = 'YOUR_USERNAME', password = 'YOUR_PASSWORD' ) # Enter a context with an instance of the API client with client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = dag_api.DAGApi(api_client) dag_id = "dag_id_example" # str | The DAG ID. task_id = "task_id_example" # str | The task ID. # example passing only required values which don't have defaults set try: # Get simplified representation of a task api_response = api_instance.get_task(dag_id, task_id) pprint(api_response) except client.ApiException as e: print("Exception when calling DAGApi->get_task: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
dag_id | str | The DAG ID. | |
task_id | str | The task ID. |
Status code | Description | Response headers |
---|---|---|
200 | Success. | - |
401 | Request not authenticated due to missing, invalid, authentication info. | - |
403 | Client does not have sufficient permission. | - |
404 | A specified resource is not found. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
TaskCollection get_tasks(dag_id)
Get tasks for DAG
import time import airflow_client.client from airflow_client.client.api import dag_api from airflow_client.client.model.error import Error from airflow_client.client.model.task_collection import TaskCollection from pprint import pprint # Defining the host is optional and defaults to http://localhost/api/v1 # See configuration.py for a list of all supported configuration parameters. configuration = client.Configuration( host = "http://localhost/api/v1" ) # 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 HTTP basic authorization: Basic configuration = client.Configuration( username = 'YOUR_USERNAME', password = 'YOUR_PASSWORD' ) # Enter a context with an instance of the API client with client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = dag_api.DAGApi(api_client) dag_id = "dag_id_example" # str | The DAG ID. # example passing only required values which don't have defaults set try: # Get tasks for DAG api_response = api_instance.get_tasks(dag_id) pprint(api_response) except client.ApiException as e: print("Exception when calling DAGApi->get_tasks: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
dag_id | str | The DAG ID. |
Status code | Description | Response headers |
---|---|---|
200 | Success. | - |
401 | Request not authenticated due to missing, invalid, authentication info. | - |
403 | Client does not have sufficient permission. | - |
404 | A specified resource is not found. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
DAG patch_dag(dag_id, dag)
Update a DAG
import time import airflow_client.client from airflow_client.client.api import dag_api from airflow_client.client.model.dag import DAG from airflow_client.client.model.error import Error from pprint import pprint # Defining the host is optional and defaults to http://localhost/api/v1 # See configuration.py for a list of all supported configuration parameters. configuration = client.Configuration( host = "http://localhost/api/v1" ) # 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 HTTP basic authorization: Basic configuration = client.Configuration( username = 'YOUR_USERNAME', password = 'YOUR_PASSWORD' ) # Enter a context with an instance of the API client with client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = dag_api.DAGApi(api_client) dag_id = "dag_id_example" # str | The DAG ID. dag = DAG( dag_id="dag_id_example", root_dag_id="root_dag_id_example", is_paused=True, is_subdag=True, fileloc="fileloc_example", file_token="file_token_example", owners=[ "owners_example", ], description="description_example", schedule_interval=ScheduleInterval( type="CronExpression", value="value_example", ), tags=[ Tag( name="name_example", ), ], ) # DAG | update_mask = [ "update_mask_example", ] # [str] | The fields to update on the resource. If absent or empty, all modifiable fields are updated. A comma-separated list of fully qualified names of fields. (optional) # example passing only required values which don't have defaults set try: # Update a DAG api_response = api_instance.patch_dag(dag_id, dag) pprint(api_response) except client.ApiException as e: print("Exception when calling DAGApi->patch_dag: %s\n" % e) # example passing only required values which don't have defaults set # and optional values try: # Update a DAG api_response = api_instance.patch_dag(dag_id, dag, update_mask=update_mask) pprint(api_response) except client.ApiException as e: print("Exception when calling DAGApi->patch_dag: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
dag_id | str | The DAG ID. | |
dag | DAG | ||
update_mask | [str] | The fields to update on the resource. If absent or empty, all modifiable fields are updated. A comma-separated list of fully qualified names of fields. | [optional] |
Status code | Description | Response headers |
---|---|---|
200 | Success. | - |
401 | Request not authenticated due to missing, invalid, authentication info. | - |
403 | Client does not have sufficient permission. | - |
404 | A specified resource is not found. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
TaskInstanceReferenceCollection post_clear_task_instances(dag_id, clear_task_instance)
Clear a set of task instances
Clears a set of task instances associated with the DAG for a specified date range.
import time import airflow_client.client from airflow_client.client.api import dag_api from airflow_client.client.model.clear_task_instance import ClearTaskInstance from airflow_client.client.model.error import Error from airflow_client.client.model.task_instance_reference_collection import TaskInstanceReferenceCollection from pprint import pprint # Defining the host is optional and defaults to http://localhost/api/v1 # See configuration.py for a list of all supported configuration parameters. configuration = client.Configuration( host = "http://localhost/api/v1" ) # 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 HTTP basic authorization: Basic configuration = client.Configuration( username = 'YOUR_USERNAME', password = 'YOUR_PASSWORD' ) # Enter a context with an instance of the API client with client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = dag_api.DAGApi(api_client) dag_id = "dag_id_example" # str | The DAG ID. clear_task_instance = ClearTaskInstance( dry_run=True, start_date="start_date_example", end_date="end_date_example", only_failed=True, only_running=False, include_subdags=True, include_parentdag=True, reset_dag_runs=True, ) # ClearTaskInstance | Parameters of action # example passing only required values which don't have defaults set try: # Clear a set of task instances api_response = api_instance.post_clear_task_instances(dag_id, clear_task_instance) pprint(api_response) except client.ApiException as e: print("Exception when calling DAGApi->post_clear_task_instances: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
dag_id | str | The DAG ID. | |
clear_task_instance | ClearTaskInstance | Parameters of action |
TaskInstanceReferenceCollection
Status code | Description | Response headers |
---|---|---|
200 | Success. | - |
401 | Request not authenticated due to missing, invalid, authentication info. | - |
403 | Client does not have sufficient permission. | - |
404 | A specified resource is not found. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
TaskInstanceReferenceCollection post_set_task_instances_state(dag_id, update_task_instances_state)
Set a state of task instances
Updates the state for multiple task instances simultaneously.
import time import airflow_client.client from airflow_client.client.api import dag_api from airflow_client.client.model.update_task_instances_state import UpdateTaskInstancesState from airflow_client.client.model.error import Error from airflow_client.client.model.task_instance_reference_collection import TaskInstanceReferenceCollection from pprint import pprint # Defining the host is optional and defaults to http://localhost/api/v1 # See configuration.py for a list of all supported configuration parameters. configuration = client.Configuration( host = "http://localhost/api/v1" ) # 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 HTTP basic authorization: Basic configuration = client.Configuration( username = 'YOUR_USERNAME', password = 'YOUR_PASSWORD' ) # Enter a context with an instance of the API client with client.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = dag_api.DAGApi(api_client) dag_id = "dag_id_example" # str | The DAG ID. update_task_instances_state = UpdateTaskInstancesState( dry_run=True, task_id="task_id_example", execution_date="execution_date_example", include_upstream=True, include_downstream=True, include_future=True, include_past=True, new_state="success", ) # UpdateTaskInstancesState | Parameters of action # example passing only required values which don't have defaults set try: # Set a state of task instances api_response = api_instance.post_set_task_instances_state(dag_id, update_task_instances_state) pprint(api_response) except client.ApiException as e: print("Exception when calling DAGApi->post_set_task_instances_state: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
dag_id | str | The DAG ID. | |
update_task_instances_state | UpdateTaskInstancesState | Parameters of action |
TaskInstanceReferenceCollection
Status code | Description | Response headers |
---|---|---|
200 | Success. | - |
401 | Request not authenticated due to missing, invalid, authentication info. | - |
403 | Client does not have sufficient permission. | - |
404 | A specified resource is not found. | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]