Code Monkey home page Code Monkey logo

squash-api's Introduction

SQuaSH API

RESTful API for managing Science Pipelines metrics. You can learn more about SQuaSH in SQR-009.

Deployment

The SQuaSH API is deployed as part of the Science Platform. The SQuaSH API Helm chart is maintained at the SQuaRE charts repository.

We assume you are familiar with the SQuaSH MySQL 5.7 instances on Google Cloud SQL. There's an instance for each SQuaSH environment, sandbox and prod. Such instances exist under the sqre project on Google Cloud Platform, and the service account key can be found on SQuaRE 1Password (search for SQuaSH Cloud SQL service account key).

Development workflow

  1. Clone the repository
git clone  https://github.com/lsst-sqre/squash-api.git
cd squash-api
  1. Install the dependencies
python3 -m venv venv

Activate the Flask app and set development mode in your environment

echo "export FLASK_APP=squash.app:app" >> venv/bin/activate
echo "export FLASK_ENV=development" >> venv/bin/activate

source venv/bin/activate
make update
  1. Run the app locally

To run the app locally you need a local instances of MySQL, Redis, InfluxDB and Chronograf, which are set up through docker-compose.

docker-compose up -d

The SQuaSH API requires the AWS credentials present in the environment. It also assumes that the s3://squash-dev.data/ S3 bucket was previously created.

Note that by default the app will run using the development config profile, which is equivalent to do:

export SQUASH_API_PROFILE="squash.config.Development"
flask run

The app will run at http://127.0.0.1:5000

On another terminal start the Celery worker:

celery -A squash.tasks -E -l DEBUG worker

Running tests

Pytest uses the docker-compose setup to run functional tests:

tox -e pytest

To run unit tests only, you can skip the docker-compose using a pytest marker:

pytest -m "unit"

You can also exercise the API running the test API notebook.

squash-api's People

Contributors

afausti avatar dependabot[bot] avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.