%global _empty_manifest_terminate_build 0 Name: python-apache-airflow-client Version: 2.6.0 Release: 1 Summary: Apache Airflow API (Stable) License: Apache License 2.0 URL: https://airflow.apache.org/ Source0: https://mirrors.nju.edu.cn/pypi/web/packages/0f/26/e56d0bd66c6d2f80db49084a8de450553df2f6381f27bcc826ee1acf6c5a/apache-airflow-client-2.6.0.tar.gz BuildArch: noarch Requires: python3-urllib3 Requires: python3-dateutil %description # Apache Airflow Python Client ## Requirements. Python >= 3.7 ## Installation & Usage ### pip install You can install directly using pip: ```sh pip install apache-airflow-client ```` ### Setuptools Or install via [Setuptools](http://pypi.python.org/pypi/setuptools). ```shell git clone git@github.com:apache/airflow-client-python.git cd airflow-client-python python setup.py install --user ``` (or `sudo python setup.py install` to install the package for all users) Then import the package: ```python import airflow_client.client ``` ## Changelog See [CHANGELOG.md](https://github.com/apache/airflow-client-python/blob/main/CHANGELOG.md) for keeping track on what has changed in the client. ## Getting Started Please follow the [installation procedure](#installation--usage) and then run the following example python script: ```python import uuid import airflow_client.client try: # If you have rich installed, you will have nice colored output of the API responses from rich import print except ImportError: print("Output will not be colored. Please install rich to get colored output: `pip install rich`") pass from airflow_client.client.api import config_api, dag_api, dag_run_api from airflow_client.client.model.dag_run import DAGRun # The client must use 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. # # In case of the basic authentication below, make sure that Airflow is # configured also with the basic_auth as backend additionally to regular session backend needed # by the UI. In the `[api]` section of your `airflow.cfg` set: # # auth_backend = airflow.api.auth.backend.session,airflow.api.auth.backend.basic_auth # # Make sure that your user/name are configured properly - using the user/password that has admin # privileges in Airflow # Configure HTTP basic authorization: Basic configuration = airflow_client.client.Configuration( host="http://localhost:8080/api/v1", username='admin', password='admin' ) # Make sure in the [core] section, the `load_examples` config is set to True in your airflow.cfg # or AIRFLOW__CORE__LOAD_EXAMPLES environment variable set to True DAG_ID = "example_bash_operator" # Enter a context with an instance of the API client with airflow_client.client.ApiClient(configuration) as api_client: errors = False print('[blue]Getting DAG list') dag_api_instance = dag_api.DAGApi(api_client) try: api_response = dag_api_instance.get_dags() print(api_response) except airflow_client.client.OpenApiException as e: print("[red]Exception when calling DagAPI->get_dags: %s\n" % e) errors = True else: print('[green]Getting DAG list successful') print('[blue]Getting Tasks for a DAG') try: api_response = dag_api_instance.get_tasks(DAG_ID) print(api_response) except airflow_client.client.exceptions.OpenApiException as e: print("[red]Exception when calling DagAPI->get_tasks: %s\n" % e) errors = True else: print('[green]Getting Tasks successful') print('[blue]Triggering a DAG run') dag_run_api_instance = dag_run_api.DAGRunApi(api_client) try: # Create a DAGRun object (no dag_id should be specified because it is read-only property of DAGRun) # dag_run id is generated randomly to allow multiple executions of the script dag_run = DAGRun( dag_run_id='some_test_run_' + uuid.uuid4().hex, ) api_response = dag_run_api_instance.post_dag_run(DAG_ID, dag_run) print(api_response) except airflow_client.client.exceptions.OpenApiException as e: print("[red]Exception when calling DAGRunAPI->post_dag_run: %s\n" % e) errors = True else: print('[green]Posting DAG Run successful') # Get current configuration. Note, this is disabled by default with most installation. # You need to set `expose_config = True` in Airflow configuration in order to retrieve configuration. conf_api_instance = config_api.ConfigApi(api_client) try: api_response = conf_api_instance.get_config() print(api_response) except airflow_client.client.OpenApiException as e: print("[red]Exception when calling ConfigApi->get_config: %s\n" % e) errors = True else: print('[green]Config retrieved successfully') if errors: print ('\n[red]There were errors while running the script - see above for details') else: print ('\n[green]Everything went well') ``` See [README](https://github.com/apache/airflow-client-python/blob/main/README.md#documentation-for-api-endpoints) for full client API documentation. %package -n python3-apache-airflow-client Summary: Apache Airflow API (Stable) Provides: python-apache-airflow-client BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-apache-airflow-client # Apache Airflow Python Client ## Requirements. Python >= 3.7 ## Installation & Usage ### pip install You can install directly using pip: ```sh pip install apache-airflow-client ```` ### Setuptools Or install via [Setuptools](http://pypi.python.org/pypi/setuptools). ```shell git clone git@github.com:apache/airflow-client-python.git cd airflow-client-python python setup.py install --user ``` (or `sudo python setup.py install` to install the package for all users) Then import the package: ```python import airflow_client.client ``` ## Changelog See [CHANGELOG.md](https://github.com/apache/airflow-client-python/blob/main/CHANGELOG.md) for keeping track on what has changed in the client. ## Getting Started Please follow the [installation procedure](#installation--usage) and then run the following example python script: ```python import uuid import airflow_client.client try: # If you have rich installed, you will have nice colored output of the API responses from rich import print except ImportError: print("Output will not be colored. Please install rich to get colored output: `pip install rich`") pass from airflow_client.client.api import config_api, dag_api, dag_run_api from airflow_client.client.model.dag_run import DAGRun # The client must use 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. # # In case of the basic authentication below, make sure that Airflow is # configured also with the basic_auth as backend additionally to regular session backend needed # by the UI. In the `[api]` section of your `airflow.cfg` set: # # auth_backend = airflow.api.auth.backend.session,airflow.api.auth.backend.basic_auth # # Make sure that your user/name are configured properly - using the user/password that has admin # privileges in Airflow # Configure HTTP basic authorization: Basic configuration = airflow_client.client.Configuration( host="http://localhost:8080/api/v1", username='admin', password='admin' ) # Make sure in the [core] section, the `load_examples` config is set to True in your airflow.cfg # or AIRFLOW__CORE__LOAD_EXAMPLES environment variable set to True DAG_ID = "example_bash_operator" # Enter a context with an instance of the API client with airflow_client.client.ApiClient(configuration) as api_client: errors = False print('[blue]Getting DAG list') dag_api_instance = dag_api.DAGApi(api_client) try: api_response = dag_api_instance.get_dags() print(api_response) except airflow_client.client.OpenApiException as e: print("[red]Exception when calling DagAPI->get_dags: %s\n" % e) errors = True else: print('[green]Getting DAG list successful') print('[blue]Getting Tasks for a DAG') try: api_response = dag_api_instance.get_tasks(DAG_ID) print(api_response) except airflow_client.client.exceptions.OpenApiException as e: print("[red]Exception when calling DagAPI->get_tasks: %s\n" % e) errors = True else: print('[green]Getting Tasks successful') print('[blue]Triggering a DAG run') dag_run_api_instance = dag_run_api.DAGRunApi(api_client) try: # Create a DAGRun object (no dag_id should be specified because it is read-only property of DAGRun) # dag_run id is generated randomly to allow multiple executions of the script dag_run = DAGRun( dag_run_id='some_test_run_' + uuid.uuid4().hex, ) api_response = dag_run_api_instance.post_dag_run(DAG_ID, dag_run) print(api_response) except airflow_client.client.exceptions.OpenApiException as e: print("[red]Exception when calling DAGRunAPI->post_dag_run: %s\n" % e) errors = True else: print('[green]Posting DAG Run successful') # Get current configuration. Note, this is disabled by default with most installation. # You need to set `expose_config = True` in Airflow configuration in order to retrieve configuration. conf_api_instance = config_api.ConfigApi(api_client) try: api_response = conf_api_instance.get_config() print(api_response) except airflow_client.client.OpenApiException as e: print("[red]Exception when calling ConfigApi->get_config: %s\n" % e) errors = True else: print('[green]Config retrieved successfully') if errors: print ('\n[red]There were errors while running the script - see above for details') else: print ('\n[green]Everything went well') ``` See [README](https://github.com/apache/airflow-client-python/blob/main/README.md#documentation-for-api-endpoints) for full client API documentation. %package help Summary: Development documents and examples for apache-airflow-client Provides: python3-apache-airflow-client-doc %description help # Apache Airflow Python Client ## Requirements. Python >= 3.7 ## Installation & Usage ### pip install You can install directly using pip: ```sh pip install apache-airflow-client ```` ### Setuptools Or install via [Setuptools](http://pypi.python.org/pypi/setuptools). ```shell git clone git@github.com:apache/airflow-client-python.git cd airflow-client-python python setup.py install --user ``` (or `sudo python setup.py install` to install the package for all users) Then import the package: ```python import airflow_client.client ``` ## Changelog See [CHANGELOG.md](https://github.com/apache/airflow-client-python/blob/main/CHANGELOG.md) for keeping track on what has changed in the client. ## Getting Started Please follow the [installation procedure](#installation--usage) and then run the following example python script: ```python import uuid import airflow_client.client try: # If you have rich installed, you will have nice colored output of the API responses from rich import print except ImportError: print("Output will not be colored. Please install rich to get colored output: `pip install rich`") pass from airflow_client.client.api import config_api, dag_api, dag_run_api from airflow_client.client.model.dag_run import DAGRun # The client must use 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. # # In case of the basic authentication below, make sure that Airflow is # configured also with the basic_auth as backend additionally to regular session backend needed # by the UI. In the `[api]` section of your `airflow.cfg` set: # # auth_backend = airflow.api.auth.backend.session,airflow.api.auth.backend.basic_auth # # Make sure that your user/name are configured properly - using the user/password that has admin # privileges in Airflow # Configure HTTP basic authorization: Basic configuration = airflow_client.client.Configuration( host="http://localhost:8080/api/v1", username='admin', password='admin' ) # Make sure in the [core] section, the `load_examples` config is set to True in your airflow.cfg # or AIRFLOW__CORE__LOAD_EXAMPLES environment variable set to True DAG_ID = "example_bash_operator" # Enter a context with an instance of the API client with airflow_client.client.ApiClient(configuration) as api_client: errors = False print('[blue]Getting DAG list') dag_api_instance = dag_api.DAGApi(api_client) try: api_response = dag_api_instance.get_dags() print(api_response) except airflow_client.client.OpenApiException as e: print("[red]Exception when calling DagAPI->get_dags: %s\n" % e) errors = True else: print('[green]Getting DAG list successful') print('[blue]Getting Tasks for a DAG') try: api_response = dag_api_instance.get_tasks(DAG_ID) print(api_response) except airflow_client.client.exceptions.OpenApiException as e: print("[red]Exception when calling DagAPI->get_tasks: %s\n" % e) errors = True else: print('[green]Getting Tasks successful') print('[blue]Triggering a DAG run') dag_run_api_instance = dag_run_api.DAGRunApi(api_client) try: # Create a DAGRun object (no dag_id should be specified because it is read-only property of DAGRun) # dag_run id is generated randomly to allow multiple executions of the script dag_run = DAGRun( dag_run_id='some_test_run_' + uuid.uuid4().hex, ) api_response = dag_run_api_instance.post_dag_run(DAG_ID, dag_run) print(api_response) except airflow_client.client.exceptions.OpenApiException as e: print("[red]Exception when calling DAGRunAPI->post_dag_run: %s\n" % e) errors = True else: print('[green]Posting DAG Run successful') # Get current configuration. Note, this is disabled by default with most installation. # You need to set `expose_config = True` in Airflow configuration in order to retrieve configuration. conf_api_instance = config_api.ConfigApi(api_client) try: api_response = conf_api_instance.get_config() print(api_response) except airflow_client.client.OpenApiException as e: print("[red]Exception when calling ConfigApi->get_config: %s\n" % e) errors = True else: print('[green]Config retrieved successfully') if errors: print ('\n[red]There were errors while running the script - see above for details') else: print ('\n[green]Everything went well') ``` See [README](https://github.com/apache/airflow-client-python/blob/main/README.md#documentation-for-api-endpoints) for full client API documentation. %prep %autosetup -n apache-airflow-client-2.6.0 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-apache-airflow-client -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Wed May 10 2023 Python_Bot - 2.6.0-1 - Package Spec generated