Skip to content

Commit

Permalink
handling ensembles
Browse files Browse the repository at this point in the history
  • Loading branch information
M-7th committed Nov 30, 2023
1 parent be89a90 commit ae2527a
Show file tree
Hide file tree
Showing 2 changed files with 74 additions and 1 deletion.
73 changes: 73 additions & 0 deletions .github/workflows/ensemble.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: "GenerateEnsemble"
on:
workflow_dispatch:
# schedule:
# - cron: "15 11,23 * * 2,3"


jobs:

ensemble:
# if: github.repository_owner == 'Predizioni-Epidemiologiche-Italia'
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
# checkout repo
- uses: actions/checkout@v3
with:
path: './repo/'

# Checkout the python tools repo
# -------------------------------------------
- name: checkout python tools repo
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
repository: 'Predizioni-Epidemiologiche-Italia/hub-tools'
ref: 'main'
path: './tools/'

- uses: r-lib/actions/setup-r@v2
with:
install-r: false
use-public-rspm: true

# - name: Installing dependencies
# run: |
# install.packages("remotes")
# remotes::install_github("Infectious-Disease-Modeling-Hubs/hubUtils")
# remotes::install_github("Infectious-Disease-Modeling-Hubs/hubEnsembles")
# install.packages("dplyr")
# install.packages("jsonlite")
# install.packages("optparse")
# install.packages("purrr")
# shell: Rscript {0}

# - name: Generate Ensemble
# run: |
# # call R script from tools
# Rscript ./tools/R-code/generate-ensemble.R --hub_path "./repo" --agg_fun "median" --model_id "hubEnsemble" --team_id "respicast"

- name: Commit changes
uses: EndBug/add-and-commit@v7
with:
cwd: './repo'
message: "Update ensemble data"
default_author: github_actions
push: true

# Save changes to artifact for later persisting
- name: Save changes to artifact
env:
changed_files: ${{ needs.validate_request.outputs.changed_files }}
run: |
echo "{ \"pr-changes\" : \"previsioni/Influcast-Ensemble/2023_46.csv\" }" > pr_changes.json
- name: Upload changes
uses: actions/upload-artifact@v2
with:
name: pr_changes
path: ./pr_changes.json

2 changes: 1 addition & 1 deletion .github/workflows/store_changes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Persist Forecasts and target data changes to json

on:
workflow_run:
workflows: [ValidateSubmission, ValidateSurveillance]
workflows: [ValidateSubmission, ValidateSurveillance, GenerateEnsemble]

types:
- completed
Expand Down

0 comments on commit ae2527a

Please sign in to comment.