A GraphQL API for Nextline
Project description
nextline-graphql
The plugin-based framework of the Nextline backend API server
Table of Contents
- Introduction
- Citation
- Packages
- How to run the Nextline backend API server
- Configuration
- Check out code for development
Introduction
Nextline is a DAQ sequencer of the Observatory Control System (OCS). Nextline allows line-by-line execution of concurrent Python scripts, which control telescopes, by multiple users simultaneously from web browsers.
Nextline consists of multiple packages. This package, nextline-graphql, provides the framework for the backend API server. It is a plugin-based framework. Features are added by plugins.
Citation
Please use the following DOI for the core package to cite Nextline in general unless you need to refer to a specific package.
Packages
Core package
- nextline: The core functionality of Nextline. It controls the execution of the Python scripts. It is used by the plugin ctrl.
Plugin system
The plugin system of nextline-graphql is apluggy.
Plugins
Internal plugins
These plugins are included in this package.
- graphql: The entry point of the GraphQL API, implemented with strawberry-graphql.
- ctrl: The core plugin that controls the execution of the Python scripts. It uses the package nextline.
External plugins
These plugins are not included in this package. They can be installed separately.
- nextline-rdb: A relational database for nextline. It stores configuration, execution history, and other information. It is implemented with SQLAlchemy 2.
- nextline-schedule: An interface to the SO scheduler.
- nextline-alert: An interface to the alert system campana.
Web App
The front-end web app is currently in a single package. The development of a plugin-based system is planned.
- nextline-web: (TypeScript) The front-end web app of Nextline. It is a Vue.js app.
How to run the Nextline backend API server
The section shows how to run the Nextline backend API server. How to run the front-end web app is described elsewhere.
As a Docker container
Docker images of the Nextline backend API server are created as ghcr.io/simonsobs/nextline-graphql. These images are created by the Dockerfile. No external plugins are included in the images.
Use, for example, the following command to run as a Docker container.
docker run -p 8080:8000 ghcr.io/simonsobs/nextline-graphql
If you access to the API server with a web browser, you will see the GraphQL IDE: http://localhost:8080/.
To include external plugins, you can create a new Docker image with ghcr.io/simonsobs/nextline-graphql as the base image. For example, nextline-rdb shows how to create a new Docker image with nextline-rdb as an external plugin.
In a virtual environment
You can create a virtual environment, install packages, and run the API server as follows.
python -m venv venv
source venv/bin/activate
pip install nextline-graphql
pip install uvicorn
uvicorn --lifespan on --factory --port 8080 nextlinegraphql:create_app
Check with a web browser at http://localhost:8080/.
If you check out external plugins, nextline-graphql automatically detects them as plugins. An example can be described in nextline-rdb.
Configuration
nextline-graphql uses dynaconf for configuration management. nextline-graphql itself does not have any configuration except for logging. External plugins have configurations.
Check out code for development
This section shows an example way to check out code from GitHub for development.
python -m venv venv
source venv/bin/activate
git clone git@github.com:simonsobs/nextline.git
git clone git@github.com:simonsobs/nextline-graphql.git
pip install -e ./nextline/"[tests,dev]"
pip install -e ./nextline-graphql/"[tests,dev]"
To run
uvicorn --port 8080 --lifespan on --factory --reload --reload-dir nextline-graphql --reload-dir nextline nextlinegraphql:create_app
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file nextline_graphql-0.7.10.tar.gz
.
File metadata
- Download URL: nextline_graphql-0.7.10.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ca198b979c02cbc2fb224880b4fc127d8bc2d9892edc1b7ec41a3c59ff201ed0 |
|
MD5 | 115932b3de3f4744c6486873c56eb41c |
|
BLAKE2b-256 | 364959fc25a7edb2b5f2f0eebf99030d61831f65c8fc6f6fce3b3ff23f283494 |
File details
Details for the file nextline_graphql-0.7.10-py3-none-any.whl
.
File metadata
- Download URL: nextline_graphql-0.7.10-py3-none-any.whl
- Upload date:
- Size: 28.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 13398996bacbf5e394d1145dbe3d1a03007438a40fc7ce036046e10ac347ef9e |
|
MD5 | e3fdf858a1c4d3ed64865d1c72623369 |
|
BLAKE2b-256 | 4c52adedb13cf8936389c6ece638d03f214c118eeeae155f2386ae9f22efaea5 |