Skip to main content

Enables execution of Studio Flows and Jobs from Airflow

Project description

SAS® Airflow Provider

Current major capabilities of the SAS® Studio Flow Operator

  • Execute a SAS Studio Flow stored either on the File System or in SAS Content
  • Select the Compute Context to be used for execution of a SAS Studio Flow
  • Specify whether SAS logs of a SAS Studio Flow execution should be returned and displayed in Airflow
  • Specify parameters (init_code, wrap_code) to be used for code generation
  • Honor return code of a SAS Studio Flow in Airflow. In particular, if a SAS Studio Flow fails, Airflow raises an exception as well and stops execution
  • Authenticate via oauth token or via user/password (i.e. generation of oauth token prior to each call)

Getting started

Please note that this file is no substitute for reading and understanding the Airflow documentation. This file is only intended to provide a quick start for the SAS providers. Unless an issue relates specifically to the SAS providers, the Airflow documentation should be consulted.

Install Airflow

Follow instructions at https://airflow.apache.org/docs/apache-airflow/stable/installation/index.html to install Airflow. If you just want to evaluate the SAS providers, then the simplest path would be to install via PYPI and run Airflow on the local machine in a virtual environment.

Install the SAS provider

If you want to build the package from these sources, install the build module using pip install build and then run python -m build from the root of the repository which will create a wheel file in the dist subdirectory.

Installing in a local virtual environment

The SAS provider is available as a package published in PyPI. To install it, switch to the Python environment where Airflow is installed, and run the following command:

pip install sas-airflow-provider

If you would like to install the provider from a package you built locally, run:

pip install dist/sas_airflow_provider_xxxxx.whl

Installing in a container

There are a few ways to provide the package:

  • Environment variable: _PIP_ADDITIONAL_REQUIREMENTS Set this variable to the command line that will be passed to pip install
  • Create a dockerfile that adds the pip install command to the base image and edit the docker-compose file to use "build" (there is a comment in the docker compose file where you can change it)

Create a connection to SAS

In order to connect to SAS Viya from the Airflow operator, you will need to create a connection. The easiest way to do this is to go into the Airflow UI under Admin/Connections and create a new connection using the blue + button. Select SAS from the list of connection types, and enter sas_default as the name. The applicable fields are host (http or https url to your SAS Viya install), login and password. It is also possible to specify an OAuth token by creating a json body in the extra field. For example {"token": "oauth_token_here"}. If a token is found it is used instead of the user/password. Please be aware of security considerations when storing sensitive information in a connection. Consult https://airflow.apache.org/docs/apache-airflow/stable/security/index.html for details. TLS verification can be disabled (not recommended) by specifying the following in the extra field {"ssl_certificate_verification": false } In addition, a custom TLS CA certificate bundle file can be used as follows: {"ssl_certificate_verification": "/path/to/trustedcerts.pem"}

Running a DAG with a SAS provider

See example files in the src/sas_airflow_provider/example_dags directory. These dags can be modified and placed in your Airflow dags directory.

Mac note: If you are running Airflow standalone on a Mac, there is a known issue regarding how process forking works. This causes issues with the urllib which is used by the operator. To get around it set NO_PROXY=* in your environment prior to running Airflow in standalone mode. Eg: export NO_PROXY="*"

Prerequisites for running demo DAGs

You will need to create a SAS Studio Flow or a Job Definition before you can reference it from a DAG. The easiest way is to use the SAS Studio UI to do this.

Contributing

We welcome your contributions! Please read CONTRIBUTING.md for details on how to submit contributions to this project.

License

This project is licensed under the Apache 2.0 License.

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

sas-airflow-provider-0.0.11.tar.gz (22.8 kB view details)

Uploaded Source

Built Distribution

sas_airflow_provider-0.0.11-py3-none-any.whl (35.0 kB view details)

Uploaded Python 3

File details

Details for the file sas-airflow-provider-0.0.11.tar.gz.

File metadata

  • Download URL: sas-airflow-provider-0.0.11.tar.gz
  • Upload date:
  • Size: 22.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for sas-airflow-provider-0.0.11.tar.gz
Algorithm Hash digest
SHA256 cd5e652c5058d52fc6cb055fb5f231a8b680c85a1638d3c57007559c35603b64
MD5 abcead39858d90feadf8f38d42eba51e
BLAKE2b-256 68fd3785f1adb07fe2fd8ea070e788c2d567c5d0d435764c4a0dda9f5fef6704

See more details on using hashes here.

File details

Details for the file sas_airflow_provider-0.0.11-py3-none-any.whl.

File metadata

File hashes

Hashes for sas_airflow_provider-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 90c863fea40380f25af949f45de5a79a081e5d3b12b918b56ecfd5c0eabb86e1
MD5 015444fa3e1fc9e6fccdb6454773c692
BLAKE2b-256 14deee884857745c6a501bc81d2ddee88db1db8188fe936b4b1ebed3940592ff

See more details on using hashes here.

Supported by

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