st4sd-registry-backend

REST Proxy to the ST4SD Runtime Service used by the ST4SD Registry UI. Retrieve parameterised virtual-experiment packages, experiment instances, and view logs.

https://github.com/st4sd/st4sd-registry-backend

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.0%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

REST Proxy to the ST4SD Runtime Service used by the ST4SD Registry UI. Retrieve parameterised virtual-experiment packages, experiment instances, and view logs.

Basic Info
  • Host: GitHub
  • Owner: st4sd
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Size: 55.7 KB
Statistics
  • Stars: 0
  • Watchers: 2
  • Forks: 1
  • Open Issues: 0
  • Releases: 9
Created about 3 years ago · Last pushed 6 months ago
Metadata Files
Readme Contributing License Code of conduct Citation Maintainers

README.md

ST4SD Registry Backend

The ST4SD Registry backend is a proxy to the ST4SD Runtime Service for the ST4SD Registry UI. It is a simple REST API written in Python.

Quick links

Getting started

Requirements

Python

Running and developing this project requires a recent Python version, it is suggested to use Python 3.7 or above. You can find instructions on how to install Python on the official website.

Development

Creating a virtual environment (optional)

Ensure you have virtualenv installed with:

shell virtualenv --version

If you don't have it installed, run:

shell pip install virtualenv

Create a virtual environment called with:

shell virtualenv venv

This will create a Python virtual environment called venv. Activate it with:

shell source venv/bin/activate

To deactivate it, simply use:

shell deactivate

Installing dependencies

Install the dependencies for this project with:

bash pip install -r requirements.txt

Developing locally

To spin up a local development build of the ST4SD Registry Backend you will need to have a working OpenShift deployment of ST4SD, as it will have to connect to other components (the Runtime Service and the Datastore).

Getting a token to access ST4SD

As the backend will have to authenticate to ST4SD, you will need to provide a token that has sufficient authorizations. The safest option is to use the workflow-operator token.

  1. Log into your cluster from the command line (using oc login) and ensure you're in the project where you have installed ST4SD (using oc project).
  2. List the secrets available in the namespace you are in and look for ones related to the workflow-operator as follows (your output should be similar):

bash oc get secrets | grep workflow-operator workflow-operator-dockercfg-jnlx9 kubernetes.io/dockercfg 1 168d workflow-operator-token-28qgm kubernetes.io/service-account-token 4 168d workflow-operator-token-g6594 kubernetes.io/service-account-token 4 168d

In this example we will use workflow-operator-token-28qgm.

  1. Get the Service Account token and save it to a file:

bash oc get secret workflow-operator-token-28qgm -o jsonpath='{.data.token}' | base64 -d > $HOME/.st4sd_serviceaccount_token

This will store the token in a file called .st4sd_serviceaccount_token in your home directory.

Creating a development entry in settings.toml

The backend stores its configuration in the settings.toml file. By default it will use the production configuration, which uses internal OpenShift DNS routing. As these routes won't work outside of the cluster, we will need to provide the external ones.

In your terminal, get the external base route for your cluster with:

bash ST4SD_AUTH_ROUTE=$(oc get route st4sd-authentication -o jsonpath='{.spec.host}')

Run the following command from your terminal to extend the toml configuration file automatically:

bash echo -e "\n\n[development] runtime_service_endpoint = \"https://${ST4SD_AUTH_ROUTE}/rs/\" datastore_registry_endpoint = \"https://${ST4SD_AUTH_ROUTE}/ds-registry/\" datastore_rest_endpoint = \"https://${ST4SD_AUTH_ROUTE}/ds-mongodb-proxy/\" token_path=\"$HOME/.st4sd_serviceaccount_token\" " >> settings.toml

Using the development configuration

To ensure the Backend uses the development configuration we need to set the ENV_FOR_DYNACONF environment variable. From your terminal run:

bash export ENV_FOR_DYNACONF=development

Spinning up the backend locally

We can start the local backend with:

bash python app.py

Note that it's normal to see the following output when launching the backend:

bash Unable to import pythonlsf - limited LSF functionality will be available Unable to import tinydb module - tinydb interface not available

Lint and fix files

This project uses black to format the code. You can install it and use it to lint your code with:

bash pip install black black .

Code not following black formatting will not be merged.

Help and Support

Please feel free to reach out to one of the maintainers listed in the MAINTAINERS.md page.

Contributing

We always welcome external contributions. Please see our guidance for details on how to do so.

References

If you use ST4SD in your projects, please consider citing the following:

bibtex @software{st4sd_2022, author = {Johnston, Michael A. and Vassiliadis, Vassilis and Pomponio, Alessandro and Pyzer-Knapp, Edward}, license = {Apache-2.0}, month = {12}, title = {{Simulation Toolkit for Scientific Discovery}}, url = {https://github.com/st4sd/st4sd-runtime-core}, year = {2022} }

License

This project is licensed under the Apache 2.0 license. Please see details here.

Owner

  • Name: ST4SD: Simulation Tookit for Scientific Discovery
  • Login: st4sd
  • Kind: organization

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: Simulation Toolkit for Scientific Discovery
message: >-
  If you use this software, please cite it using the
  metadata from this file.
type: software
authors:
  - given-names: Michael A.
    family-names: Johnston
    affiliation: IBM Research
  - given-names: Vassilis
    family-names: Vassiliadis
    affiliation: IBM Research
  - given-names: Alessandro
    family-names: Pomponio
    affiliation: IBM Research
    orcid: 'https://orcid.org/0000-0003-1655-7500'
  - given-names: Edward
    family-names: Pyzer-Knapp
    affiliation: IBM Research
identifiers:
  - type: url
    value: 'https://github.com/st4sd/st4sd-runtime-core'
    description: ST4SD Runtime
repository-code: 'https://github.com/st4sd/st4sd-runtime-core'
url: 'https://st4sd.github.io/overview/'
keywords:
  - accelerated-discovery
  - simulation
  - toolkit
license: Apache-2.0
date-released: '2022-12-08'

GitHub Events

Total
  • Release event: 1
  • Delete event: 1
  • Issue comment event: 1
  • Push event: 11
  • Pull request event: 3
  • Pull request review event: 2
  • Create event: 4
Last Year
  • Release event: 1
  • Delete event: 1
  • Issue comment event: 1
  • Push event: 11
  • Pull request event: 3
  • Pull request review event: 2
  • Create event: 4

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 0
  • Total pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: about 7 hours
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 1.5
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 2
  • Average time to close issues: N/A
  • Average time to close pull requests: about 7 hours
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 1.5
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
  • AlessandroPomponio (2)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

Dockerfile docker
  • quay.io/st4sd/official-base/st4sd-runtime-core py310-latest build
requirements.txt pypi
  • Flask ==3.0.0
  • dynaconf ==3.2.4
  • flask-cors ==4.0.0
  • flask-restx ==1.3.0
  • requests ==2.31.0
  • st4sd-runtime-core *
  • waitress ==2.1.2