Skip to content

zachliu/airflow-python-sdk

Repository files navigation

airflow-python-sdk

Overview

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

  • API version: 1.0.0
  • Package version: 1.0.1
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

For more information, please Google by yourself ¯\_(ツ)_/¯

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: Basic
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)

    try:
        # Get current configuration
        api_response = api_instance.get_config()
        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 delete_connection DELETE /connections/{connection_id} Delete a connection
ConnectionApi get_connection GET /connections/{connection_id} Get a connection
ConnectionApi get_connections GET /connections List connections
ConnectionApi patch_connection PATCH /connections/{connection_id} Update a connection
ConnectionApi post_connection POST /connections Create a connection
DAGApi get_dag GET /dags/{dag_id} Get basic information about a DAG
DAGApi get_dag_details GET /dags/{dag_id}/details Get a simplified representation of DAG
DAGApi get_dag_source GET /dagSources/{file_token} Get a source code
DAGApi get_dags GET /dags List 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 patch_dag PATCH /dags/{dag_id} Update a DAG
DAGApi post_clear_task_instances POST /dags/{dag_id}/clearTaskInstances Clear a set of task instances
DAGApi post_set_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 List DAG runs
DAGRunApi get_dag_runs_batch POST /dags/~/dagRuns/list List DAG runs (batch)
DAGRunApi post_dag_run POST /dags/{dag_id}/dagRuns Trigger a new DAG run
EventLogApi get_event_log GET /eventLogs/{event_log_id} Get a log entry
EventLogApi get_event_logs GET /eventLogs List log entries
ImportErrorApi get_import_error GET /importErrors/{import_error_id} Get an import error
ImportErrorApi get_import_errors GET /importErrors List import errors
MonitoringApi get_health GET /health Get instance status
MonitoringApi get_version GET /version Get version information
PoolApi delete_pool DELETE /pools/{pool_name} Delete a pool
PoolApi get_pool GET /pools/{pool_name} Get a pool
PoolApi get_pools GET /pools List pools
PoolApi patch_pool PATCH /pools/{pool_name} Update a pool
PoolApi post_pool POST /pools Create a pool
TaskInstanceApi get_extra_links GET /dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/links List extra links
TaskInstanceApi get_log GET /dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/logs/{task_try_number} Get logs
TaskInstanceApi get_task_instance GET /dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id} Get a task instance
TaskInstanceApi get_task_instances GET /dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances List task instances
TaskInstanceApi get_task_instances_batch POST /dags//dagRuns//taskInstances/list List task instances (batch)
VariableApi delete_variable DELETE /variables/{variable_key} Delete a variable
VariableApi get_variable GET /variables/{variable_key} Get a variable
VariableApi get_variables GET /variables List variables
VariableApi patch_variable PATCH /variables/{variable_key} Update a variable
VariableApi post_variables POST /variables Create a variable
XComApi get_xcom_entries GET /dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/xcomEntries List XCom entries
XComApi get_xcom_entry GET /dags/{dag_id}/dagRuns/{dag_run_id}/taskInstances/{task_id}/xcomEntries/{xcom_key} Get an XCom entry

Documentation For Models

Documentation For Authorization

Basic

  • Type: HTTP basic authentication

Kerberos

Author

[email protected]

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