Skip to content

gemini-hlsw/scheduler

Repository files navigation

Scheduler

Python version build tests codecov

Project Overview

The Scheduler is an automated tool for the Gemini Observatory, designed to generate and optimize observation schedules as part of the GPP project. It uses the lucupy library for modeling and supports both standalone and service modes, as well as a Jupyter-based UI for experimentation.

Features

  • Automated scheduling of observations
  • GraphQL API for integration with Gemini Program Platform
  • Jupyter notebooks for interactive exploration
  • Docker support for easy deployment

Environment Variables

Before running the scheduler, set the following environment variables:

  • PYTHONPATH: Should include the project base path.
  • REDISCLOUD_URL: Redis connection string (contact project staff for credentials).
  • APP_VERSION: Application version (e.g., dev).

Example:

export PYTHONPATH=$PYTHONPATH:/path/to/scheduler
export REDISCLOUD_URL=redis://<USER>:<PASSWORD>@redisserver.ec2.cloud.redislabs.com:12345
export APP_VERSION=dev

Installation

Local Development

Set up a virtual environment

Using uv:

# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
# Create virtual environment and install dependencies
uv sync

Run the Scheduler

As a service:

uv run python scheduler/main.py

After the scheduler service is started, it will instantiate a web server in the port 8000 by default. The service is meant to be used through the web UI https://github.com/gemini-hlsw/schedule

Standalone script:

The standalone script should be able to run a single plan request directly in the terminal and print the output

uv run python scheduler/scripts/run.py

Contribute to the repository code

Note:
To ensure GitHub Actions secrets (such as REDISCLOUD_URL) are available for testing and CI, all contributions should be made from branches within the main repository, not from forks.

  1. Clone the main repository:

    git clone https://github.com/gemini-hlsw/scheduler.git
    cd scheduler
  2. Create a new feature branch:

    git checkout -b your-feature-branch
  3. Work on your changes and commit as usual.

  4. Sync dependencies Make sure you packages are updated

    uv sync

    Commit uv.lock file changes

  5. Rebase your branch with the latest main branch before pushing:

    git fetch origin
    git rebase origin/main
  6. Push your branch to the main repository:

    git push origin your-feature-branch
  7. Open a Pull Request from your feature branch to main in the main repository.

Do not use the GitHub fork workflow.
Opening pull requests from forks will not have access to required repository secrets, and CI/CD workflows may fail.

Docker

Build and run the container:

docker build -t scheduler .
docker run -dp 8000:8000 scheduler

Access the GraphQL console at http://localhost:8000/graphql.

Updating & Troubleshooting

To update your local repository and dependencies:

git pull
pip install -U lucupy

If you encounter issues, ensure you have the latest version of lucupy and all dependencies.

Support

For help, contact the project maintainers