Skip to main content

Python Client for Apache CLI on AWS Managed Airflow

Project description

AWS MWAA Helper (Managed Workflows for Apache Airflow) - Python

Python Client for running Apache Airflow CLI commands on AWS MWAA (Managed Workflows for Apache Airflow) instances.
Built to give a client like experience for MWAA, utilizing the Apache Python Client objects.

https://docs.aws.amazon.com/mwaa/latest/userguide/airflow-cli-command-reference.html

(currently) Supported Apache Airflow CLI commands

Version Command API
v2.2.2 dags list get_dags
v2.0+ dags pause pause_dag
v2.0+ dags unpause unpause_dag
v2.0+ dags show show_dag
v2.0+ dags state get_dag_state
v2.0+ dags trigger new_dagrun
v2.0+ version get_version

Examples

Running CLI on a private VPC instance

Test locally using the following ssh tunnel configuration

ssh -D 8080 -C -N  user@example.com

Create a client with proxy config session

from mwaah import MWAAH

cli = MWAAH(
    'example-mwaa-environment',
    boto3.client('mwaa'),
    proxies={'https': 'socks5://0:8080'}
)

Setting up a new CLI session

Create a client passing in your own session

from mwaah import MWAAH
cli = MWAAH(
    'example-mwaa-environment',
    boto3.client('mwaa', region_name='example-region-1')
)

Get Version

print(cli.get_version())
2.2.2

Triggering a New DAG Run

from airflow_client.client.model.dag_run import DAGRun
from dateteim import datetime

date = datetime.now()
run = DAGRun()._from_openapi_data(
    dag_id='example_dag_id',
    execution_date=date,
    dag_run_id="dag_run_id_example"+date.__str__(),
    conf={'key': 'val'},
)
cli.new_dagrun(run)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mwaah-0.1.1.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mwaah-0.1.1-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file mwaah-0.1.1.tar.gz.

File metadata

  • Download URL: mwaah-0.1.1.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for mwaah-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b926c77acd35ffae5cbdabc28b07221d926aa0ad0f0397dd0814eaa357b4423e
MD5 4a214d8b4a7f1d338f74c85782bbd9cd
BLAKE2b-256 78a9c8281cf0f182bf3ac784bb9b7fe318596104ac4071aa33aede66a74f8519

See more details on using hashes here.

File details

Details for the file mwaah-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mwaah-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.8

File hashes

Hashes for mwaah-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 97baa4601c41cf470844c987d156b94b36caf87d8c590649fade709260e3be4b
MD5 5b93094759725e348a99531f68bddd37
BLAKE2b-256 ff46448c121b3eada694cffffba9d22e9b27eb8881a8f3c382615e91c3ccae31

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page