Skip to main content

Jupyter Notebook operator for Apache Airflow.

Project description

Airflow-Notebook is an Notebook op to enable running notebooks as part of a Airflow DAG. This package is installed on the host(s) where Apache Airflow webserver and scheduler applications reside.

Building airflow-notebook

make clean install

Usage

Example below on how to use the operator for testing purposes.

from airflow import DAG
from datetime import datetime, timedelta
from notebook_op import NotebookOp

def run_notebook_op(op_name, cos_pull_archive, pipeline_outputs, pipeline_inputs):
    op = NotebookOp(name=op_name,
                    namespace='default',
                    task_id=op_name,
                    notebook=op_name,
                    cos_endpoint='http://object.storage:30000',
                    cos_bucket='test-bucket',
                    cos_directory='test-directory',
                    cos_pull_archive=cos_pull_archive,
                    pipeline_outputs=pipeline_outputs,
                    pipeline_inputs=pipeline_inputs,
                    image='elyra/tensorflow:1.15.2-py3',
                    in_cluster=True,
                    env_vars={'AWS_ACCESS_KEY_ID': 'minio', 'AWS_SECRET_ACCESS_KEY': 'minio123',
                              'GITHUB_TOKEN': 'XXXXXXXXXXXXX'},
                    dag=dag,
    )
    return op

default_args = {
    'start_date': datetime(2020, 1, 1),
    'project_id' : '{{ pipeline_name }}',
    'retries': 1,
    'retry_delay': timedelta(minutes=3),
}

dag = DAG(
    'test_dag',
    default_args=default_args,
    description='A Sample Test DAG',
)

notebook_op_1 = run_notebook_op('generate-community-contributions',
                                'generate-community-contributions-37215ef9-70b2-450d-b1e0-655df0b96d6e.tar.gz',
                                'community_contributions.csv',
                                'None'
                                )

notebook_op_2 = run_notebook_op('generate-overview',
                                'generate-overview-5244c826-ca17-493c-aeb8-e7a224f44527.tar.gz',
                                'community_overview.csv',
                                'None',
                                )


notebook_op_3 = run_notebook_op('overview',
                                'overview-3dbdd4e8-dc24-489e-bb89-f4e6b9b5e52a.tar.gz',
                                'None',
                                'community_contributions.csv,community_overview.csv',
                                )

notebook_op_1 << notebook_op_3

notebook_op_2 << notebook_op_3

Generated Airflow DAG

Airflow DAG Example

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

airflow-notebook-0.0.2.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

airflow_notebook-0.0.2-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file airflow-notebook-0.0.2.tar.gz.

File metadata

  • Download URL: airflow-notebook-0.0.2.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.6.0.post20201009 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.9

File hashes

Hashes for airflow-notebook-0.0.2.tar.gz
Algorithm Hash digest
SHA256 b122c394026e6212c09a3720bfe2625be0f2f6b76a132bd15f56148646266061
MD5 8d1262d2e82e1f4498c8f496523eba67
BLAKE2b-256 9b9c0fc473cf394215cf5117286188e9ae53cf9af661f4d898562afd787a05ed

See more details on using hashes here.

File details

Details for the file airflow_notebook-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: airflow_notebook-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.24.0 setuptools/49.6.0.post20201009 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.7.9

File hashes

Hashes for airflow_notebook-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 728aec0b8d005e0b61e4ecdb2324e57624a196632ff638401cd4881c04814e40
MD5 354f4554bc8002d5f644aed0d16a6073
BLAKE2b-256 ac412e6a9e2c8ad57c7eaf8b43560bd6b6dd68eb527de37f40817cf639915a54

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