Forest-Loss-Driver-Prediction #168
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Forest-Loss-Driver-Prediction | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 8 * * 1' # Run at 8:00 AM UTC every Monday | |
env: | |
SERVICE_NAME: "forest_loss_driver" | |
# Name to use when creating Beaker image. | |
BEAKER_IMAGE_NAME: "forest_loss_driver" | |
# After creation, it is prefixed by username, so when we delete we need to use this | |
# full name. | |
BEAKER_IMAGE_FULL_NAME: "favyen/forest_loss_driver" | |
BEAKER_WORKSPACE: "ai2/earth-systems" | |
BEAKER_TOKEN: ${{ secrets.BEAKER_TOKEN_2 }} | |
BEAKER_ADDR: ${{ secrets.BEAKER_ADDR }} | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Cleanup disk space | |
run: | | |
sudo docker rmi $(docker image ls -aq) >/dev/null 2>&1 || true | |
sudo docker image prune --all --force >/dev/null 2>&1 || true | |
sudo rm -rf /usr/share/dotnet | |
sudo rm -rf /opt/ghc | |
sudo rm -rf /usr/local/share/boost | |
# This step produces a Docker image called forest_loss_driver. | |
- name: Build Docker Image | |
working-directory: rslp/${{ env.SERVICE_NAME }} | |
run: | | |
docker compose build | |
# We upload the image from previous step to Beaker. | |
- name: Install Beaker and Create Image | |
run: | | |
curl -s 'https://beaker.org/api/v3/release/cli?os=linux&arch=amd64' | sudo tar -zxv -C /usr/local/bin ./beaker | |
beaker image delete ${{ env.BEAKER_IMAGE_FULL_NAME }} || true | |
beaker image create --name ${{ env.BEAKER_IMAGE_NAME }} --workspace ${{ env.BEAKER_WORKSPACE }} ${{ env.DOCKER_IMAGE_NAME }} | |
env: | |
# BEAKER_TOKEN is Henry's token but it has space at beginning which causes | |
# issue when using it here. | |
# BEAKER_TOKEN_2 is Favyen's token, without the space issue. | |
# Name of Docker image created by build step. | |
DOCKER_IMAGE_NAME: forest_loss_driver | |
# Now we can launch the Beaker job. | |
# This runs inside a Docker image, so although `rslp common beaker_launcher` | |
# in theory supports uploading image, we can't use that functionality here. | |
- name: Run integrated pipeline in Beaker job | |
run: | | |
docker compose -f docker-compose.yaml run \ | |
test python -m rslp.main \ | |
common \ | |
beaker_launcher \ | |
--project ${{ env.RSLP_PROJECT }} \ | |
--workflow ${{ env.RSLP_WORKFLOW }} \ | |
--extra_args ${{ env.EXTRA_ARGS }} \ | |
--image ${{ env.BEAKER_IMAGE_NAME }} | |
env: | |
RSLP_PROJECT: forest-loss-driver | |
RSLP_WORKFLOW: integrated_pipeline | |
EXTRA_ARGS: | | |
[ | |
"--pred_pipeline_config", | |
"rslp/forest_loss_driver/inference/config/forest_loss_driver_predict_pipeline_config.yaml", | |
] |