Skip to main content

Tools for managing CEDA Sentinel DHS

Project description

CEDA Sentinel Relay Hub tools

This codebase provides a set of tools to interact with the CEDA DHS series Data Hub Relay (DHR) based on the ESA/SERCO GSS implementation. These tools will allow interaction with the GSS endpoint on the CEDA DHR and will allow programmatic control of such functions as Producers, Consumers and Ingesters. The DHS GSS system is based upon a set of Docker Containers running within Docker Swarm and has the following components:

  • GSS-Ingest is the part of the system which connects to sources (CDSE, DHuS, other GSS, Swift container or directory) to get products and put them into the system (Datastores and Metadatastores)
  • GSS-Catalogue is the access point to products stored in the system. Users need to authenticate first and then access to data and metadata.
  • GSS-Admin is a REST API used to configure Ingesters, Datastores, DatastoreGroups, MetadataStores, Quotas and their properties.
  • GSS-Toolbox is a set of scripts to initialize the database and the index (Solr)
  • GSS-Notification notifies a defined end point on product deletion activity

Installation

  1. Install the package using pip:

    pip install ceda-sentinel-dhs-tools
    
  2. Clone the repo:

    git clone https://github.com/cedadev/ceda-sentinel-dhs-tools.git
    cd ceda_sentinel_dhs_tools
    
  3. The templates contain sensitive information and are encrypted using git-crypt. To access them:

    a. Install git-crypt:

    # macOS
    brew install git-crypt
    
    # Ubuntu/Debian
    sudo apt-get install git-crypt
    
    # Windows
    Follow this installation guide (https://www.geeksforgeeks.org/how-to-install-git-crypt-on-windows/)
    

    b. Obtain the encryption key file (git-crypt-key)

    c. Unlock the repository:

    git-crypt unlock /path/to/git-crypt-key
    
  4. Configure your local GSS instance by creating a config file (e.g., local_gss_instance.cfg) and add a serviceRootUrl:

    [default]
    serviceRootUrl: http://<your-gss-instance>:8082/gss-admin-api
    

Tools

The tools in this repository will interact with the GSS Admin API and provide users the ability to control the data flow from various sources and where this data is placed to allow CEDA full operational control of the GSS analogous to the previous system (DHuS) synchroniser setup.

These operations are grouped as such:

List existing producer/consumers on local GSS.


This script shall list both matched producer and consumer pairs previously created and installed on the target GSS. This script wraps a GET to the respective GSS API endpoints:

  • http://:8082/gss-admin-api/producers
  • http://:8082/gss-admin-api/consumers/

Command Line

list_producer_consumers -l local_gss_instance.cfg

Where:

-l is the option to define the hub (or otherwise) where the operation shall be submitted. i.e. The local GSS instance we want to see the list of producers on.

-s is an optional string filter to be supplied to match content returned according to original filter.

-t is an optional string filter field defining the number of hours the LCD is behind the current date-time. If the -e option is used this will send output to the email address defined in the -e option. This will allow the user to identify where producer/consumer pairs are falling behind.

-e is an optional string containing an email address to be sent a warning if the -t option is used. Can only be used if the -t option is used.

-f is an option to output to stdout the detailed information associated with the given named producer or consumer i.e. "folder_producer1". The script will render the full JSON returned in a human readable format.

Python

import ceda_sentinel_dhs_tools as cst

cst.list_producer_consumers(
    local_config="path/to/local_gss_instance.cfg",
    filter_string="startswith(Name,'S1')",  # optional
    hours_behind=24,  # optional
    email="user@example.com",  # optional
    full_details="producer_name"  # optional
)

The output from this should group the matched producers and consumers together with basic information on the associated source URL (source hub/GSS i.e. Colhub2), the GSS instance being used (i.e. srh-services13) , filter parameter and Last Creation Date (LCD) in tabular form.

Create a new producer/consumer pair on the local GSS


This script shall allow users to generate a new producer/consumer pair on the target host based on the values within the files associated with the supplied options. Other options shall be used to defined the search string and Last Creation date. Other options may eventually be added to supplant/override other fields within the producer/consumer template.

Command Line

create_producer_consumer -t sentinel_2_producer.template -c colhub.cfg -l local_gss_instance.cfg -F "startswith(Name,'S1')"

Where:

-t is the option to define the template to be used to generate the JSON to POST to the defined instance (in the -l option) i.e. The local GSS instance we want to see the list of producers on.

-c is the option to provide the unencrypted credentials to be used in the POST-ed template to be used in the defined instance (in the -l option).

-l is the option to define the hub (or otherwise) where the operation shall be submitted. i.e. The local GSS instance we want to see the list of producers on.

-F is used to supply a filter string i.e. startswith(Name,'S1')

-L is used to define a LastPublicationDate i.e. 2025-01-15T00:00:00.00. (Optional will use current date-time if not supplied).

Python

import ceda_sentinel_dhs_tools as cst

cst.create_producer_consumer(
    template_base="colhub2_gss",
    config_file="path/to/colhub_example.cfg", 
    local_config="path//local_gss_instance.cfg",
    filter_string="startswith(Name,'S1')",
    last_publication_date="2024-01-15T00:00:00.000Z"  # optional
)

Delete or remove producer/consumers


This script shall allow users to remove paired producer/consumers (previously identified in the list tool). It shall use the DELETE operation.

Command Line

delete_producer_consumer -l local_gss_instance.cfg -n <producer_consumer base name>

Python

import ceda_sentinel_dhs_tools as cst

cst.delete_producer_consumer(
    local_config="path/to/local_gss_instance.cfg",
    base_name="my_producer"
)

The script shall parse the HTTP response to report whether this operation was successful

Adjust Quotas


Adjust HFS Data stored


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

ceda_sentinel_dhs_tools-0.1.2.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

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

ceda_sentinel_dhs_tools-0.1.2-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file ceda_sentinel_dhs_tools-0.1.2.tar.gz.

File metadata

  • Download URL: ceda_sentinel_dhs_tools-0.1.2.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.1 CPython/3.12.4 Darwin/24.2.0

File hashes

Hashes for ceda_sentinel_dhs_tools-0.1.2.tar.gz
Algorithm Hash digest
SHA256 338121a21bf17fb086965112a3d9055a2615d5c8fcc87653c7b9229a3b73f1bd
MD5 58e89506f1309c8f5107369deb4874a1
BLAKE2b-256 7d6603d682645632457397a49419352fe99807d79956883a2c72c1a3bc56ecf5

See more details on using hashes here.

File details

Details for the file ceda_sentinel_dhs_tools-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for ceda_sentinel_dhs_tools-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5997dc7971603b7ee9b97d0573083517f6cbd60eaeec01f731235bfee5e8554c
MD5 f80710b3606f1ec321fe05ff32859a61
BLAKE2b-256 6c947af034eadb000a93691721d4093505fcba169f15515483f1450bec6a0363

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