Skip to main content

Ingest frames into the science archive of an observatory control system

Project description

Ingester Library

Build Coverage Status Codacy Badge

A library for adding new science data products to an observatory control system's Science Archive. The library handles uploading files into a FileStore (S3 recommended), as well as adding records to the Science Archive's database containing the searchable metadata of all available files. Optionally, it records ingestion metrics in an openTSDB instance, which can be disabled by setting the environment variable OPENTSDB_PYTHON_METRICS_TEST_MODE=False.

Prerequisites

Optional prerequisites may be skipped for reduced functionality.

  • Python >= 3.7
  • A running Science Archive
  • A configured FileStore (S3 recommended) with write access to store data there
  • (Optional) A running OpenTSDB for metrics collection

Usage

This project depends on the OCS Archive Library, so please look through and set all of its environment variables to match your file format header keys and data storage choices. Specifically, the FILESTORE_TYPE environment variable must be set for your FileStore backend, since it defaults to dummy which stores no data. The header mapping environment variables should also be set to map to the correct keys in your data products as well. These environment variable values must match the values used in your Science Archive instance as well. Also check out the data flow documentation for more details on how to configure and use the ingester.

Installation

It is highly recommended that you install and run your python code inside a dedicated python virtual environment.

Add the ocs_ingester package to your python environment:

(venv) $ pip install ocs_ingester

Configuration

AWS and science archive credentials must be set in order to upload data. Science archive configuration as well as the AWS Bucket can be either passed explicitly or set as environment variables. The rest of the configuration must be set as environment variables.

Environment Variables

Variable Description Default
Science Archive API_ROOT Science Archive URL "http://localhost:8000/"
AUTH_TOKEN Science Archive Authentication Token. This token must be associated with an admin user. empty string
AWS BUCKET AWS S3 Bucket Name ingestertest
AWS_ACCESS_KEY_ID AWS Access Key with write access to the S3 bucket empty string
AWS_SECRET_ACCESS_KEY AWS Secret Access Key empty string
AWS_DEFAULT_REGION AWS S3 Default Region empty string
S3_ENDPOINT_URL Endpoint url for connecting to s3. This can be modified to connect to a local instance of s3. "http://s3.us-west-2.amazonaws.com"
Metrics OPENTSDB_HOSTNAME OpenTSDB Host to send metrics to empty string
OPENTSDB_PYTHON_METRICS_TEST_MODE Test mode turns off metrics collection. True or 1 to turn on test mode; False or 0 or unset to keep test mode off. False
INGESTER_PROCESS_NAME A tag set with the collected metrics to identify where the metrics are coming from ingester
SUBMIT_METRICS_ASYNCHRONOUSLY Optionally submit metrics asynchronously. This option does not apply when the command line entrypoint is used, in which case metrics are always submitted synchronously. Note that some metrics may be lost when submitted asynchronously. False

For Developers

Running the Tests

After cloning this project, from the project root and inside your virtual environment:

(venv) $ pip install -e .[tests]
(venv) $ pytest

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

ocs_ingester-3.2.0.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ocs_ingester-3.2.0-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

Details for the file ocs_ingester-3.2.0.tar.gz.

File metadata

  • Download URL: ocs_ingester-3.2.0.tar.gz
  • Upload date:
  • Size: 23.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.11.15 Linux/6.17.0-1010-azure

File hashes

Hashes for ocs_ingester-3.2.0.tar.gz
Algorithm Hash digest
SHA256 f16d1924d7f3c017d77dac05bbb1250d626d191e82a5142acb332d3f3e58df6a
MD5 1de2f73e7a313b580f1dec9bd1c0ec60
BLAKE2b-256 a25fc978138d89765704ff077683b1a0bd24c89aaa8945874dbdcc9bf1ec764e

See more details on using hashes here.

File details

Details for the file ocs_ingester-3.2.0-py3-none-any.whl.

File metadata

  • Download URL: ocs_ingester-3.2.0-py3-none-any.whl
  • Upload date:
  • Size: 24.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.11.15 Linux/6.17.0-1010-azure

File hashes

Hashes for ocs_ingester-3.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b3166489a761767937c9494b0be9e566b8d7692a375f79b2834740b4f9aec21f
MD5 c4d79b0bdad091e510d0be432fc57512
BLAKE2b-256 d17880f326a415c10b145ca5e89106a586ff77cf5450fcd624564921b3b59cb0

See more details on using hashes here.

Supported by

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