Skip to content

Commit

Permalink
Merge pull request #53 from lsst/tickets/PREOPS-4607
Browse files Browse the repository at this point in the history
PREOPS-4607 update dependencies to rubin-scheduler instead of rubin-sim
  • Loading branch information
rhiannonlynne authored Dec 8, 2023
2 parents 413bdc1 + c9bef49 commit 36e7ead
Show file tree
Hide file tree
Showing 48 changed files with 423 additions and 4,867 deletions.
63 changes: 32 additions & 31 deletions .github/workflows/build_container.yaml
Original file line number Diff line number Diff line change
@@ -1,85 +1,86 @@
name: build docker image
name: Build docker image

"on":
workflow_dispatch:

# Follows https://github.com/lsst-sqre/build-and-push-to-ghcr

jobs:
build:
build_container:
runs-on: ubuntu-latest

# See https://lsstc.slack.com/archives/C2JP8GGVC/p1698782669757349?thread_ts=1698779230.846079&cid=C2JP8GGVC
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v3

# We need to install schedview in this workflow to get the data
# for rubin_sim, as download by rs_download_data or cached by github.
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
python-version: "3.11"
auto-update-conda: true
channels: conda-forge,defaults
miniforge-variant: Mambaforge
use-mamba: true
channel-priority: strict
show-channel-urls: true

- name: configure conda and install requirements
- name: Configure conda and install requirements
id: rs-install
shell: bash -l {0}
run: |
mamba install --quiet --file=requirements.txt
mamba install --quiet --file=test-requirements.txt
mamba list rubin-sim | grep -v "#" | awk '{print $2}' > ${{ github.workspace }}/rs_version
mamba list rubin-scheduler | grep -v "#" | awk '{print $2}' > ${{ github.workspace }}/rs_version
echo "rs-version" `cat ${{ github.workspace }}/rs_version`
echo "rs-version=`cat ${{ github.workspace }}/rs_version`" >> $GITHUB_OUTPUT
echo "rs-version=`cat ${{ github.workspace }}/rs_version`" >> $GITHUB_OUTPUT
- name: Access rubin-sim-data cache
- name: Access rubin-sched-data cache
id: cache-rs
uses: actions/cache@v3
env:
cache-name: cached-rubin-sim-data
cache-name: cached-rubin-sched-data
with:
path: ${{ github.workspace }}/rubin_sim_data
path: ~/rubin_sim_data
key: ${{ env.cache-name }}-v${{ steps.rs-install.outputs.rs-version }}
restore-keys: |
${{ env.cache-name }}-v
- if: ${{ steps.cache-rs.outputs.cache-hit == 'true' }}
name: List cache contents.
shell: bash -l {0}
run: |
export RUBIN_SIM_DATA_DIR=${{ github.workspace }}/rubin_sim_data
echo $RUBIN_SIM_DATA_DIR
ls $RUBIN_SIM_DATA_DIR
echo "__contents of versions.txt__"
cat $RUBIN_SIM_DATA_DIR/versions.txt
- if: ${{ steps.cache-rs.outputs.cache-hit != 'true' }}
name: Download data.
- name: Check and update cache contents.
shell: bash -l {0}
run: |
export RUBIN_SIM_DATA_DIR=${{ github.workspace }}/rubin_sim_data
rs_download_data --force --dirs scheduler,site_models,skybrightness_pre,throughputs,tests --tdqm_disable
export RUBIN_SIM_DATA_DIR=~/rubin_sim_data
scheduler_download_data --update --tdqm_disable
# Docker image copies from github.workspace, not ~
cp -r ~/rubin_sim_data ${{ github.workspace }}/rubin_sim_data
- name: report environment
- name: Report environment
shell: bash -l {0}
run: |
echo pwd is `pwd`
echo python is `which python`
echo github.workspace is ${{ github.workspace }}
find ${{ github.workspace }} -maxdepth 2
- uses: lsst-sqre/build-and-push-to-ghcr@v1
- uses: lsst-sqre/build-and-push-to-ghcr@tickets/DM-41857
id: build
with:
image: ${{ github.repository }}
github_token: ${{ secrets.GITHUB_TOKEN }}
dockerfile: Dockerfile
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache

- name: Report build outputs
shell: bash -l {0}
run: |
echo Pushed ghcr.io/${{ github.repository }}:${{ steps.build.outputs.tag }}
echo Fully qualified image digest: ${{ steps.build.outputs.fully_qualified_image_digest }}
echo Tag of the image: ${{ steps.build.outputs.tag }}
- run: echo Pushed ghcr.io/${{ github.repository }}:${{ steps.build.outputs.tag }}
10 changes: 5 additions & 5 deletions .github/workflows/build_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,32 @@ jobs:
channel-priority: strict
show-channel-urls: true

- name: configure and install requirements and documenteer
- name: Configure and install requirements and documenteer
shell: bash -l {0}
run: |
conda config --set always_yes yes
conda install --quiet --file=requirements.txt
conda install --quiet pip
pip install "documenteer[guide]"
- name: install schedview
- name: Install schedview
shell: bash -l {0}
run: |
echo `pwd`
python -m pip install .
- name: check conda and documenteer
- name: Check conda and documenteer
shell: bash -l {0}
run: |
conda list
- name: build docs
- name: Build docs
shell: bash -l {0}
run: |
cd docs
package-docs build
- name: upload documentation
- name: Upload documentation
uses: lsst-sqre/ltd-upload@v1
with:
project: "schedview"
Expand Down
18 changes: 10 additions & 8 deletions .github/workflows/cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
make-cache:
runs-on: ubuntu-latest
runs-on: macos-latest
steps:
- uses: actions/checkout@v4

Expand All @@ -25,20 +25,20 @@ jobs:
show-channel-urls: true
activate-environment: rubin-sim

- name: Install rubin-sim
- name: Install rubin-scheduler/rubin-sim
id: rs-install
shell: bash -l {0}
run: |
mamba install --quiet rubin_sim
mamba list rubin-sim | grep -v "#" | awk '{print $2}' > ${{ github.workspace }}/rs_version
mamba install --quiet rubin-scheduler
mamba list rubin-scheduler | grep -v "#" | awk '{print $2}' > ${{ github.workspace }}/rs_version
echo "rs-version" `cat ${{ github.workspace }}/rs_version`
echo "rs-version=`cat ${{ github.workspace }}/rs_version`" >> $GITHUB_OUTPUT
- name: Access rubin-sim-data cache
- name: Access rubin-sched-data cache
id: cache-rs
uses: actions/cache@v3
env:
cache-name: cached-rubin-sim-data
cache-name: cached-rubin-sched-data
with:
path: ~/rubin_sim_data
key: ${{ env.cache-name }}-v${{ steps.rs-install.outputs.rs-version }}
Expand All @@ -56,11 +56,11 @@ jobs:
cat $RUBIN_SIM_DATA_DIR/versions.txt
- if: ${{ steps.cache-rs.outputs.cache-hit != 'true' }}
name: Download data.
name: Update/Download data.
shell: bash -l {0}
run: |
export RUBIN_SIM_DATA_DIR=~/rubin_sim_data
rs_download_data --force --dirs scheduler,site_models,skybrightness_pre,throughputs,tests --tdqm_disable
scheduler_download_data --update --tdqm_disable
- name: Check data
shell: bash -l {0}
Expand All @@ -70,6 +70,8 @@ jobs:
ls $RUBIN_SIM_DATA_DIR
echo "__contents of versions.txt__"
cat $RUBIN_SIM_DATA_DIR/versions.txt
echo "is it in sync?"
scheduler_download_data --versions


32 changes: 32 additions & 0 deletions .github/workflows/cleanup_cache.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Auto cleanup cache for branch
on:
pull_request:
types:
- closed

jobs:
cleanup-cache:
runs-on: ubuntu-latest
steps:
- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1)
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: ${{ github.repository }}
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge



24 changes: 24 additions & 0 deletions .github/workflows/ruff.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Ruff and iSort
on:
# Trigger the workflow on push (to main) or pull request
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

jobs:
isort:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: isort/isort-action@v1
with:
requirements-files: "requirements.txt test-requirements.txt"
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: chartboost/ruff-action@v1
29 changes: 9 additions & 20 deletions .github/workflows/test_and_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,55 +36,44 @@ jobs:
channel-priority: strict
show-channel-urls: true

- name: configure conda and install requirements
- name: Configure conda and install requirements
id: rs-install
shell: bash -l {0}
run: |
mamba install --quiet --file=requirements.txt
mamba install --quiet --file=test-requirements.txt
mamba list rubin-sim | grep -v "#" | awk '{print $2}' > ${{ github.workspace }}/rs_version
mamba list rubin-scheduler | grep -v "#" | awk '{print $2}' > ${{ github.workspace }}/rs_version
echo "rs-version" `cat ${{ github.workspace }}/rs_version`
echo "rs-version=`cat ${{ github.workspace }}/rs_version`" >> $GITHUB_OUTPUT
- name: Access rubin-sim-data cache
- name: Access rubin-sched-data cache
id: cache-rs
uses: actions/cache@v3
env:
cache-name: cached-rubin-sim-data
cache-name: cached-rubin-sched-data
with:
path: ~/rubin_sim_data
key: ${{ env.cache-name }}-v${{ steps.rs-install.outputs.rs-version }}
restore-keys: |
${{ env.cache-name }}-v
- if: ${{ steps.cache-rs.outputs.cache-hit == 'true' }}
name: List cache contents.
- name: Check and update cache contents.
shell: bash -l {0}
run: |
export RUBIN_SIM_DATA_DIR=~/rubin_sim_data
echo $RUBIN_SIM_DATA_DIR
ls $RUBIN_SIM_DATA_DIR
echo "__contents of versions.txt__"
cat $RUBIN_SIM_DATA_DIR/versions.txt
scheduler_download_data --update --tdqm_disable
- if: ${{ steps.cache-rs.outputs.cache-hit != 'true' }}
name: Download data.
shell: bash -l {0}
run: |
export RUBIN_SIM_DATA_DIR=~/rubin_sim_data
rs_download_data --force --dirs scheduler,site_models,skybrightness_pre,throughputs,tests --tdqm_disable
- name: install schedview
- name: Install schedview
shell: bash -l {0}
run: |
echo `pwd`
python -m pip install . --no-deps
- name: conda list
- name: Conda list
shell: bash -l {0}
run: conda list

- name: run unit tests
- name: Run unit tests
shell: bash -l {0}
run: |
export RUBIN_SIM_DATA_DIR=~/rubin_sim_data
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
# schedview

[![pypi](https://img.shields.io/pypi/v/schedview.svg)](https://pypi.org/project/schedview/)
[![Conda Version](https://img.shields.io/conda/vn/conda-forge/schedview.svg)](https://anaconda.org/conda-forge/schedview) <br>
[![Run CI](https://github.com/lsst/schedview/actions/workflows/test_and_build.yaml/badge.svg)](https://github.com/lsst/schedview/actions/workflows/test_and_build.yaml)
[![codecov](https://codecov.io/gh/lsst/schedview/branch/main/graph/badge.svg?token=2BUBL8R9RH)](https://codecov.io/gh/lsst/schedview)

The `schedview` module provides tools for visualizing Rubin Observatory scheduler behaviour and Rubin Observatory/LSST survey status, including:

- A collection of functions, eacho of which creates an independent visualization of some aspect of scheduler behaviour, state, or surve progress. These functions may be used in `jupyter` notebooks or other python applications, or combined into dashboards or other higher level applications.
Expand Down
2 changes: 2 additions & 0 deletions ci/Jenkinsfile_schedview.conda
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@Library('JenkinsShared')_
ExternalCondaPipeline("schedview")
2 changes: 1 addition & 1 deletion container_environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dependencies:
- numpy
- pandas
- astropy >= 5.3
- rubin-sim >= 1.3.0
- rubin-scheduler
- uranography >= 1.1.0
- bokeh >= 3.1.1
- panel >= 1.1.0
Expand Down
2 changes: 1 addition & 1 deletion environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: schedview
channels:
- conda-forge
dependencies:
- rubin-sim
- rubin-scheduler
- bokeh
- pytest-flake8
- pytest-black
Expand Down
4 changes: 2 additions & 2 deletions notebooks/architecture.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -530,9 +530,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "schedview",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "schedview"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand Down
Loading

0 comments on commit 36e7ead

Please sign in to comment.