From f8a6876a16c93f1dae09c4c6236530be5471b825 Mon Sep 17 00:00:00 2001 From: Paolo Milano <87755502+M-7th@users.noreply.github.com> Date: Fri, 1 Dec 2023 02:16:22 -0800 Subject: [PATCH] Update ensemble.yml --- .github/workflows/ensemble.yml | 69 ++++++++++++++++------------------ 1 file changed, 33 insertions(+), 36 deletions(-) diff --git a/.github/workflows/ensemble.yml b/.github/workflows/ensemble.yml index 71d41e78..e804d933 100644 --- a/.github/workflows/ensemble.yml +++ b/.github/workflows/ensemble.yml @@ -1,23 +1,16 @@ 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 }} + baseline_job: + runs-on: ubuntu-latest steps: - # checkout repo - - uses: actions/checkout@v3 - with: - path: './repo/' # Checkout the python tools repo # ------------------------------------------- @@ -25,49 +18,53 @@ jobs: uses: actions/checkout@v3 with: token: ${{ secrets.GITHUB_TOKEN }} - repository: 'Predizioni-Epidemiologiche-Italia/hub-tools' + repository: 'european-modelling-hubs/hub-tools' ref: 'main' path: './tools/' - - - uses: r-lib/actions/setup-r@v2 + + # Checkout the data repository + # ------------------------------------------- + - name: checkout data repo + uses: actions/checkout@v3 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} + token: ${{ secrets.GITHUB_TOKEN }} + repository: 'Predizioni-Epidemiologiche-Italia/Influcast' + ref: 'main' + path: './repo/' - # - 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 + + # Run Pyton code + # ------------------------- + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - run: pip install pandas==1.2.5 isoweek==1.3.3 + + - name: Pyhton + id: compute_ensemble + run: | + python ./tools/code/compute_ensemble.py + + - name: Commit data repo changes uses: EndBug/add-and-commit@v7 with: cwd: './repo' - message: "Update ensemble data" + message: "Update data storage" 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 }} + changed_files: ${{ steps.compute_ensemble.outputs.ensemble_file }} run: | - echo "{ \"pr-changes\" : \"previsioni/Influcast-Ensemble/2023_46.csv\" }" > pr_changes.json + echo "{ \"pr-changes\" : \"previsioni/Influcast-quantileBaseline/$changed_files\" }" > pr_changes.json - name: Upload changes uses: actions/upload-artifact@v2 with: name: pr_changes path: ./pr_changes.json - \ No newline at end of file +