Skip to content

zachliu/airflow-python-sdk

Repository files navigation

airflow-python-sdk

Apache Airflow management API.

This Python package is automatically generated by the OpenAPI Generator project based on the specs:

  • API version: 1.0.0
  • Package version: 0.3.7
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit https://github.com/zachliu

Requirements.

Python >= 3.6

Installation & Usage

pip install

The python package is hosted on PyPI, you can install directly using:

pip install airflow-python-sdk

Then import the package:

import airflow_python_sdk

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import airflow_python_sdk

Getting Started

Please follow the installation procedure and then run the following:

import time
import airflow_python_sdk
from pprint import pprint
from airflow_python_sdk.api import config_api
from airflow_python_sdk.model.config import Config
from airflow_python_sdk.model.error import Error
# Defining the host is optional and defaults to http://localhost/api/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = airflow_python_sdk.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: basicAuth
configuration = airflow_python_sdk.Configuration(
    host = "https://<your-airflow-2.0.0>/api/v1",
    username = 'YOUR_USERNAME',
    password = 'YOUR_PASSWORD'
)


# Enter a context with an instance of the API client
with airflow_python_sdk.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = config_api.ConfigApi(api_client)
    limit = 100 # int | The numbers of items to return. (optional) (default to 100)
offset = 0 # int | The number of items to skip before starting to collect the result set. (optional)

    try:
        # Get current configuration
        api_response = api_instance.get_config(limit=limit, offset=offset)
        pprint(api_response)
    except airflow_python_sdk.ApiException as e:
        print("Exception when calling ConfigApi->get_config: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to http://localhost/api/v1

Class Method HTTP request Description
ConfigApi get_config GET /config Get current configuration
ConnectionApi create_connection POST /connections Create connection entry
ConnectionApi delete_connection DELETE /connections/{connection_id} Delete a connection entry
ConnectionApi get_connection GET /connections/{connection_id} Get a connection entry
ConnectionApi get_connections GET /connections Get all connection entries
ConnectionApi patch_connection PATCH /connections/{connection_id} Update a connection entry
DAGApi clear_task_instances POST /dags/{dag_id}/clearTaskInstances Clear a set of task instances
DAGApi get_dag GET /dags/{dag_id} Get basic information about a DAG
DAGApi get_dag_source GET /dagSources/{file_token} Get source code using file token
DAGApi get_dag_structure GET /dags/{dag_id}/structure Get simplified representation of DAG.
DAGApi get_dags GET /dags Get all DAGs
DAGApi get_task GET /dags/{dag_id}/tasks/{task_id} Get simplified representation of a task.
DAGApi get_tasks GET /dags/{dag_id}/tasks Get tasks for DAG
DAGApi update_dag PATCH /dags/{dag_id} Update the specific DAG
DAGApi update_task_instances_state POST /dags/{dag_id}/updateTaskInstancesState Set a state of task instances
DAGRunApi delete_dag_run DELETE /dags/{dag_id}/dagRuns/{dag_run_id} Delete a DAG Run
DAGRunApi get_dag_run GET /dags/{dag_id}/dagRuns/{dag_run_id} Get a DAG Run
DAGRunApi get_dag_runs GET /dags/{dag_id}/dagRuns Get all DAG Runs
DAGRunApi trigger_dag_run POST /dags/{dag_id}/dagRuns Trigger a new DAG run
DAGRunApi update_dag_run PATCH /dags/{dag_id}/dagRuns/{dag_run_id} Update a DAG Run
EventLogApi create_event_log POST /eventLogs Create event log
EventLogApi delete_event_log_entry DELETE /eventLogs/{event_log_id} Delete a log entry
EventLogApi get_event_log GET /eventLogs Get all log entries from event log
EventLogApi get_event_log_entry GET /eventLogs/{event_log_id} Get a log entry
EventLogApi update_event_log_entry PATCH /eventLogs/{event_log_id} Update a log entry
ImportErrorApi delete_import_error DELETE /importErrors/{import_error_id} Delete an import error
ImportErrorApi get_import_error GET /importErrors/{import_error_id} Get an import errors
ImportErrorApi get_import_errors GET /importErrors Get all import errors
PoolApi create_pool POST /pools Create a pool
PoolApi delete_pool DELETE /pools/{pool_id} Delete a pool
PoolApi get_pool GET /pools/{pool_id} Get a pool
PoolApi get_pools GET /pools Get all pools
PoolApi get_task_instances GET /dags/{dag_id}/taskInstances Get list of task instance of DAG.
PoolApi upadte_pool PATCH /pools/{pool_id} Update a pool
TaskInstanceApi delete_task_instance DELETE /dags/{dag_id}/taskInstances/{task_id}/{execution_date} Delete DAG Run
TaskInstanceApi get_extra_links GET /dags/{dag_id}/taskInstances/{task_id}/{execution_date}/links Get extra links for task instance
TaskInstanceApi get_logs GET /dags/{dag_id}/taskInstances/{task_id}/{execution_date}/logs/{task_try_number} Get logs for specific task instance
TaskInstanceApi get_task_instance GET /dags/{dag_id}/taskInstances/{task_id}/{execution_date} Get a task instance
TaskInstanceApi update_task_instance PATCH /dags/{dag_id}/taskInstances/{task_id}/{execution_date} Update a task instance
VariableApi create_variable POST /variables Create a variables
VariableApi delete_variable DELETE /variables/{variable_id} Delete variable
VariableApi get_variable GET /variables/{variable_id} Get a variables by id
VariableApi get_variables GET /variables Get all variables
VariableApi lookup_variable GET /variables/lookup Get variable using its key.
VariableApi update_variable PATCH /variables/{variable_id} Update a variable by id
XComApi delete_x_com_value DELETE /dags/{dag_id}/taskInstances/{task_id}/{execution_date}/xcomValues/{key} Delete an XCom entry
XComApi get_x_com_value GET /dags/{dag_id}/taskInstances/{task_id}/{execution_date}/xcomValues/{key} Get an XCom entry
XComApi get_x_com_values GET /dags/{dag_id}/taskInstances/{task_id}/{execution_date}/xcomValues Get all XCom values
XComApi update_x_com_value PATCH /dags/{dag_id}/taskInstances/{task_id}/{execution_date}/xcomValues/{key} Update an XCom entry
XComApi update_x_com_values POST /dags/{dag_id}/taskInstances/{task_id}/{execution_date}/xcomValues Create an XCom entry

Documentation For Models

Documentation For Authorization

basicAuth

  • Type: HTTP basic authentication

Author

zach.z.liu@gmail.com

Notes for Large OpenAPI documents

If the OpenAPI document is large, imports in airflow_python_sdk.apis and airflow_python_sdk.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1: Use specific imports for apis and models like:

  • from airflow_python_sdk.api.default_api import DefaultApi
  • from airflow_python_sdk.model.pet import Pet

Solution 1: Before importing the package, adjust the maximum recursion limit as shown below:

import sys
sys.setrecursionlimit(1500)
import airflow_python_sdk
from airflow_python_sdk.apis import *
from airflow_python_sdk.models import *

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages