Skip to main content

py-orca

PyPI-Server codecov Project generated with PyScaffold

Python package for connecting services and building data pipelines

This Python package provides the components to connect various third-party services such as Synapse, Nextflow Tower, and SevenBridges to build data pipelines using a workflow management system like Airflow.

Demonstration Script

This repository includes a demonstration script called demo.py, which showcases how you can use py-orca to launch and monitor your workflows on Nextflow Tower. Specifically, it illustrates how to process an RNA-seq dataset using a series of workflow runs, namely nf-synapse/synstage, nf-core/rnaseq, and nf-synapse/synindex. py-orca can be used with any Python-compatible workflow management system to orchestrate each step (e.g. Airflow, Prefect, Dagster). The demonstration script uses Metaflow because it's easy to run locally and has an intuitive syntax.

The script assumes that the following environment variables are set. Before setting them up, ensure that you have an AWS profile configured for a role that has access to the dev/ops tower workspace you plan to launch your workflows from. You can set these environment variables using whatever method you prefer (e.g. using an .env file, sourcing a shell script, etc). Refer to .env.example for the format of their values as well as examples.

  • NEXTFLOWTOWER_CONNECTION_URI
  • SYNAPSE_CONNECTION_URI
  • AWS_PROFILE (or another source of AWS credentials)

Once your environment variables are set, you can create a virtual environment, install the Python dependencies, and run the demonstration script (after downloading it) as follows. Note that you will need to update the s3_prefix parameter so that it points to an S3 bucket that is accessible to your Tower workspace.

Creating and setting up your py-orca virtual environment and executing demo.py

Below are the instructions for creating and setting up your virtual environment and executing the demo.py. You can also check the tutorial here. If you would like to set up a developer environment with the relevant dependencies, you can execute the shell script dev_setup in a clone of this repository stored on your machine. You can run it either on your local or on the EC2 instance. Establishing a development environment on an EC2 instance could encounter hurdles. You might need to install Python build dependencies before using pyenv to manage Python versions. You can refer to this doc to resolve the dependency issue. The openssl11-devel is not available on EC2: Linux Docker v1.3.9 so you can install openssl-devel instead. Moreover, you might run into missing GCC error, you can install GCC usng sudo yum install gcc.

# Create and activate a Python virtual environment (tested with Python 3.10)
python3 -m venv venv/
source venv/bin/activate

# Install Python dependencies
python3 -m pip install 'py-orca[all]' 'metaflow' 'pyyaml' 's3fs'

Before running the example below, ensure that the s3_prefix points to an S3 bucket your Nextflow dev or prod tower workspace has access to. In the example below, we will point to the example-dev-project-tower-scratch S3 bucket because we will be launching our workflows within the example-dev-project workspace in tower-dev. In this case, you can use either of the workflows-nextflow-dev profiles to access the S3 bucket.

# Run the script using an example dataset
python3 demo.py run --dataset_id 'syn51514585' --s3_prefix 's3://example-dev-project-tower-scratch/work'

Once your run takes off, you can follow the output logs in your terminal, or stay updated with your workflow progress on the web client. Be sure that your synstage workflow run has a unique name, and is not an iteration of a previous run (i.e. my_test_dataset_synstage_2, my_test_dataset_synstage_3, and so on). This is because the demo.py script does not currently support being able to locate the staged samplesheet file if it has been staged under a run name that is non-unique.

The above dataset ID (syn51514585) refers to the following YAML file, which should be accessible to Sage employees. Similarly, the samplesheet ID below (syn51514475) should also be accessible to Sage employees. However, there is no secure way to make the output folder accessible to Sage employees, so the synindex step will fail if you attempt to run this script using the example dataset ID. This should be sufficient to get a feel for using py-orca, but feel free to create your own dataset YAML file on Synapse with an output folder that you own.

id: my_test_dataset
samplesheet: syn51514475
output_folder: syn51514559

PyScaffold

This project has been set up using PyScaffold 4.3. For details and usage information on PyScaffold see https://pyscaffold.org/.

putup --name orca --markdown --github-actions --pre-commit --license Apache-2.0 py-orca

Metadata

Release files for py-orca 1.5.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for py-orca 1.5.3
File Size Uploaded Provenance
py_orca-1.5.3.tar.gz 72.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for py-orca 1.5.3
File Interpreter ABI Platform
py_orca-1.5.3-py3-none-any.whl Python 3 none any Details

Total release size: 113.7 kB

Release files / py_orca-1.5.3.tar.gz

Download URL py_orca-1.5.3.tar.gz
Size 72.4 kB
Tags Source
SHA-256 checksum
How to use checksums
7784fd7d540255cec83d219534ea77fbbcefdf8f60f1c20aeca57f0018007b99
BLAKE2b-256 checksum
How to use checksums
b13f66f6bb798451fe592242327a76d2f63ffaf1d473218688c2ad8afd424697
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / py_orca-1.5.3-py3-none-any.whl

Download URL py_orca-1.5.3-py3-none-any.whl
Size 41.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a27d14a7cc4462b84374420c1f6d6b1b94d652b2df7be4c42f6833010e6e8076
BLAKE2b-256 checksum
How to use checksums
d06b94dc0178307fb5dd27cf51d37d8c0c8141e1fa7056e46b79a2e807b3d47c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for py-orca 1.5.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page