Skip to main content

Cirrus Library

Project description

build-status-image coverage-status-image pypi-version

Cirrus Library

A common set of functions used by the Cirrus geospatial pipeline. This library are convenience functions for interacting with the various Cirrus AWS resources (queues, Lambdas, Batch, DynamoDB, etc.) and should be preferred over writing separate code where possible.

Installation

Cirrus-lib requires boto3-utils, a library of convenience functions built upon boto3. Cirrus-lib is published to PyPi which is the preferred method of installing:

$ pip install cirrus-lib

# install specific version
$ pip install cirrus-lib==0.1.0

# in a requirements.txt file - the tilda (~) will install the highest compatible version
cirrus-lib~=0.1.0

Modules

Module Description
process_payload ProcessPayload and ProcessPayloads classes representing a Cirrus input payloads and a set of ProcessPayloads
errors Custom Error classes
statedb The StateDB class for interacting with the Cirrus state database (DynamoDB)
transfer Convenience functions for uploading and download assets in STAC Items
utils Miscellaneous utility functions

process payload

errors

The errors module contains a single class: InvalidInput, which can be thrown from a task if there is a problem with the input to the task. The Item will be marked as INVALID in the state database rather than FAILED to avoid running it again.

statedb

The StateDB class from the statedb module is used to interact with the Cirrus state database (DynamoDB): creating new items in the database, querying, and updating statuses. Each item in the state database represents one input payload into Cirrus. The StateDB class is abstracted from what is actually stored in the DynamoDB, which is optimized for queries. The actual entry in the database can be retrieved with the StateDB.get_dbitem() and StateDB.get_dbitems() functions which are used internally, but clients should generally opt to use StateDB.get_items(), which translates the dbitem into:

Field Name Type Description
payload_id string The ID of the Cirrus input payload
collections string A list of all the collections used by the input items
workflow string The name of the workflow used to process the input data
items string A list of all the input Item IDs
payload string The s3 URL of the original input payload JSON
state string One of: 'PROCESSING', 'COMPLETED', 'FAILED', 'INVALID'
created string The datetime that this item was created in the database
updated string The datetime stamp that this item's state was last updated
executions [string] A list of http URLs to the State Machine executions, in chronological order
outputs [string] If state is COMPLETED, a list of s3 (if private payload) or http (if public) URLs of all STAC Items generated by this process.
last_error string This is the error message from the last FAILED or INVALID execution, if any. It is not cleared if state is PROCESSING or COMPLETED

payload_id: The payload ID is formed by a combination of all the input collections, output collections, and the name of the workflow.

transfer

The transfer module contains convenience functions for transferring data.

Function Description
get_s3_session Get a boto3-utils s3 object for transfer (used by the other functions) to/from s3
download_from_http Download a file from an HTTP url
download_item_assets For a given STAC Item download 1 or more assets to a local path
upload_item_assets For a given STAC Item upload 1 or more assets to s3

utils

This module contains miscellaneous utility functions.

Function Description
submit_batch_job Start a Cirrus Batch job with a given payload

About

Cirrus is an open-source pipeline for processing geospatial data in AWS. Cirrus was developed by Element 84 originally under a [NASA Access project].

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

cirrus-lib-0.6.2.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

cirrus_lib-0.6.2-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

File details

Details for the file cirrus-lib-0.6.2.tar.gz.

File metadata

  • Download URL: cirrus-lib-0.6.2.tar.gz
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for cirrus-lib-0.6.2.tar.gz
Algorithm Hash digest
SHA256 5f9ae62a3856413fc6e8cc7ef920b55be4a5403ee3404b3422323c627fbf8a8e
MD5 0c213677552b39203d666fc0d7911747
BLAKE2b-256 37abced3e12f8f0b675d9e105714ce411cd055c7841419f5a0e418e79b9760f3

See more details on using hashes here.

File details

Details for the file cirrus_lib-0.6.2-py3-none-any.whl.

File metadata

  • Download URL: cirrus_lib-0.6.2-py3-none-any.whl
  • Upload date:
  • Size: 22.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for cirrus_lib-0.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5c92f03fff313634cfafd56d0b7db831ac34ced5ef8cc6c5f07293e8733bddb4
MD5 fc703e776c58c22018a7c767700d87a8
BLAKE2b-256 69650dcc2ee45645ae55d7152369071eeef83c531523c81271887519b4dbab21

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