Skip to main content

A GraphQL API for Nextline

Project description

PyPI - Version PyPI - Python Version 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.0.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

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

nextline_graphql-0.5.0-py2.py3-none-any.whl (23.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file nextline_graphql-0.5.0.tar.gz.

File metadata

  • Download URL: nextline_graphql-0.5.0.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for nextline_graphql-0.5.0.tar.gz
Algorithm Hash digest
SHA256 61cd9f9e5bcb45a24dc63236e098ba7c575a31ef3936716cfeb041251099280f
MD5 d8285ffed0d6a708bda5ded7a1faff6d
BLAKE2b-256 09c0b82cd32d51e9b7fd0347daafa7bf0685801993f4ed7a5714268831c20801

See more details on using hashes here.

File details

Details for the file nextline_graphql-0.5.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for nextline_graphql-0.5.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ccdd980ab3dbb03e822706b069cefc1f743eec47a65d73289e100410776e127a
MD5 9ce41c725e213608293cf64058526515
BLAKE2b-256 62e56eaa18233a1d140d01514149a9b4c6978448ac768bd46e57eac594ce31cd

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