TSO is a scheduling tool written in Python for use by astronomical researchers in order to consider a wide variety of constraints and attempt to produce an optimal observation schedule.
The main entrypoint into TSO is through the tsocli sub-module.
The details can be found in the README of the submodule.
To install the cli tool just execute the following
pip install -e .(install the project)tsocli -hstart learning/using the entrypoint
conda- https://conda.io/miniconda.html (useful in managing multiple python environments)docker- https://docs.docker.com/install (useful for running interfacing services or databases in a lightweight fashion)docker-compose- https://docs.docker.com/compose/install (useful for organizing docker containers with a more efficient workflow)
In this repository there is an environment.yml file that contains information about the dependencies required by this project. It also specifies tso as the name of the environment.
conda env create -f environment.yml
MacOS/Linux
source activate tso
Windows
activate tso
If you'd like to work against a lightweight instance of the database or do some rapid iteration on test data sets, Docker can be of use to you while working on this project.
Docker can be installed here and docker-compose can be installed here.
From the root of the project execute the following:
docker-compose up --build -d
This executes docker-compose which will read the docker-compose.yml file and stand up docker containers with the images defined there. The --build flag tells it to always build a new image (in case of changes). -d tells it to run in "detached" mode (or else it will take over your prompt to display the container logs).
From the root of the project:
cd db./maintain_db migrate
This will run a container with a tool called Flyway within. It will run the scripts within the db/migrations directory (likely just the schema). It will also run any scripts in the db/sample-data where we will house scripts that insert test data.
There are two ways for generating test TSO data. A python script supports these methods.
generate_test_data.py Methodology
- Using
generate_test_data.py sql-- Connecting directly to DB through python and executing statements - Using
generate_test_data.py file-- Outputting a file locally to be used with flyway/Docker....other methods.
Sometimes it can be useful to start from a fresh database (most useful to pick up changes you have made to test data, for example). Since we are not working with a production database, we need not worry about wiping our local database clean and starting over.
From the root of the project:
cd db./maintain_db clean
You can now apply migrations again against a clean database.