Skip to main content

Sage Prefect Tasks

⚠️ Warning: This repository is a work in progress. ⚠️

Python package of useful Prefect tasks for common use cases at Sage Bionetworks.

Some thoughts are included below the Demo Flow and Usage.

Inspired by Pocket/data-flows.

Demo Flow

Demo Flow

Demo Usage

Getting access

To run this demo, you'll need the following access:

  • You need to ask Bruno for edit-access on the INCLUDE Sandbox Synapse project.
  • You need to ask Bruno for edit-access on the include-sandbox Cavatica project.

Getting set up

# Create a virtual environment with the Python dependencies
pipenv install

# Copy the example `.env` file and update the auth tokens
cp .env.example .env

Run the flow at the command line

You'll need to get set up first.

# Run the demo (pipenv will automatically load the `.env` file)
pipenv run python demo.py

Inspect the flow using the Prefect Server UI

You'll need to get set up first.

# Deploy Prefect Server (Orion)
prefect orion start

# Explore the flow runs in Prefect Server
# Usually hosted at http://127.0.0.1:4200/

# Stop the running server with Ctrl-C

Thoughts

  • The CavaticaBaseTask demonstrates a use case for classes (i.e. extending Task) as opposed to functions (i.e. decorated by @task). On the other hand, SynapseBaseTask doesn't really benefit from the class structure.

  • The SevenBridges Python client embeds the client instance into every resource object, which prevents cloudpickle to serialize these objects due to TypeError: cannot pickle '_thread.lock' object.

    import os
    import cloudpickle
    import sevenbridges as sbg
    
    api = sbg.Api(
        url="https://cavatica-api.sbgenomics.com/v2", token=os.environ["SB_AUTH_TOKEN"]
    )
    proj = api.projects.query(name="include-sandbox")[0]
    proj._API = None
    proj._api = None
    proj._data.api = None
    pickle = cloudpickle.dumps(proj)
    

Note

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

Metadata

Release files for sagetasks 0.4.0

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

Source distribution (sdist)

Source distribution for sagetasks 0.4.0
File Size Uploaded Provenance
sagetasks-0.4.0.tar.gz 331.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sagetasks 0.4.0
File Interpreter ABI Platform
sagetasks-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 355.4 kB

Release files / sagetasks-0.4.0.tar.gz

Download URL sagetasks-0.4.0.tar.gz
Size 331.2 kB
Tags Source
SHA-256 checksum
How to use checksums
06af12ea24068bde4f2567bd6c1444cf7317dfca2d05d0c703d6745ae039440f
BLAKE2b-256 checksum
How to use checksums
0e94e0140ceaaf9ccd61d0138a4b646a9ad6cd4a3efffedd27e1066eb325cf92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Release files / sagetasks-0.4.0-py3-none-any.whl

Download URL sagetasks-0.4.0-py3-none-any.whl
Size 24.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6bf0f9fa7aa158160c43727c4c1f177331d5ce5cfd9081c97bf2b979e8cf83c7
BLAKE2b-256 checksum
How to use checksums
cc3fcdbd66267433dc8be5b6dbc4c032742df9358eac4fd0941e34cc774630f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.6

Security for sagetasks 0.4.0

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