Skip to main content

A GraphQL API for Nextline

Project description

PyPI - Version PyPI - Python Version Test Status Test Status Test Status codecov

nextline-graphql

A GraphQL API for Nextline

Nextline allows line-by-line execution of concurrent Python scripts by multiple users simultaneously from web browsers. Nextline is being developed as a DAQ sequencer of the Observatory Control System (OCS).

Packages

How to run the Nextline GraphQL API

The section shows how to run the Nextline GraphQL API server. How to run the client website will be described elsewhere.

As a Docker container

Docker images of the Nextline GraphQL API server are created as ghcr.io/simonsobs/nextline-graphql. These images are created by the Dockerfile.

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/.

With a persistent DB

Nextline-graphql stores the execution history and other information in the DB. It uses SQLAlchemy, with, by default, a SQLite in-memory database.

An environment variable in the container

The container has one environment variable, which is to change the DB URL of SQLAlchemy.

Environment variable Default value Description
NEXTLINE_DB__URL sqlite:///:memory:?check_same_thread=false The DB URL of SQLAlchemy

For example, the following command uses a file on the host machine db/db.sqlite3 as the persistent DB. The directory db/ and the file db.sqlite3 will be created if they don't exist.

docker run -p 8080:8000 --env NEXTLINE_DB__URL='sqlite:////db/db.sqlite3' -v "$(pwd)/db:/db" ghcr.io/simonsobs/nextline-graphql

from PyPI

It is also possible to install with pip and run.

pip install nextline-graphql
uvicorn --lifespan on --factory --port 8080 nextlinegraphql:create_app

The environment variable NEXTLINE_DB__URL mentioned above can be used to specify the SQLAlchemy DB URL.

Check with a web browser at http://localhost:8080/.

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

License

  • Nextline is licensed under the MIT license.

Contact

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

nextline_graphql-0.5.4.tar.gz (14.1 kB view hashes)

Uploaded Source

Built Distribution

nextline_graphql-0.5.4-py2.py3-none-any.whl (26.7 kB view hashes)

Uploaded Python 2 Python 3

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