From 39728165dc74a0c55251af60386916d9bee9e821 Mon Sep 17 00:00:00 2001 From: ersilia-bot Date: Tue, 16 Apr 2024 07:39:28 +0000 Subject: [PATCH] updating readme [skip ci] --- .github/scripts/verify_model_outcome.py | 27 +++++++++++++++++++ .github/workflows/test-model-pr.yml | 18 ++++++++++++- .github/workflows/test-model.yml | 18 ++++++++++++- .../workflows/upload-model-to-dockerhub.yml | 16 +++++------ 4 files changed, 68 insertions(+), 11 deletions(-) create mode 100644 .github/scripts/verify_model_outcome.py diff --git a/.github/scripts/verify_model_outcome.py b/.github/scripts/verify_model_outcome.py new file mode 100644 index 0000000..e8944d2 --- /dev/null +++ b/.github/scripts/verify_model_outcome.py @@ -0,0 +1,27 @@ +import csv + +def check_non_null_outcomes_in_output_csv(csv_file_path): + with open(csv_file_path, 'r') as csv_file: + csv_reader = csv.reader(csv_file) + header = next(csv_reader) + row = next(csv_reader) + for val in row[2:]: # Skip the first two columns (Inchikey and input) + if val not in ['', None]: + return False + return True + +if __name__ == '__main__': + # Read file path from command line + import sys + if len(sys.argv) < 2: + print('Usage: python verify_model_output.py ') + exit(1) + + output_csv_file = sys.argv[1] + + if check_non_null_outcomes_in_output_csv(output_csv_file): + # If there are null outcomes, exit with status code 1 + print('All outcomes are null') + else: + print('Some outcomes are not null') + diff --git a/.github/workflows/test-model-pr.yml b/.github/workflows/test-model-pr.yml index 5d309d2..93cb8f2 100644 --- a/.github/workflows/test-model-pr.yml +++ b/.github/workflows/test-model-pr.yml @@ -11,7 +11,23 @@ jobs: - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # pin@v3.5.2 with: lfs: true - + +# This might stop working in the future, so we need to keep an eye on it + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@main + with: + # this might remove tools that are actually needed, + # if set to "true" but frees about 6 GB + tool-cache: true + + # all of these default to true, but feel free to set to + # "false" if necessary for your workflow + android: true + dotnet: true + haskell: true + large-packages: true + swap-storage: true + - name: Add conda to system path run: echo $CONDA/bin >> $GITHUB_PATH diff --git a/.github/workflows/test-model.yml b/.github/workflows/test-model.yml index f27d993..65e997f 100644 --- a/.github/workflows/test-model.yml +++ b/.github/workflows/test-model.yml @@ -16,7 +16,23 @@ jobs: persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token fetch-depth: 0 # otherwise, you will failed to push refs to dest repo lfs: 'true' - + +# This might stop working in the future, so we need to keep an eye on it + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@main + with: + # this might remove tools that are actually needed, + # if set to "true" but frees about 6 GB + tool-cache: true + + # all of these default to true, but feel free to set to + # "false" if necessary for your workflow + android: true + dotnet: true + haskell: true + large-packages: true + swap-storage: true + - name: Add conda to system path run: echo $CONDA/bin >> $GITHUB_PATH diff --git a/.github/workflows/upload-model-to-dockerhub.yml b/.github/workflows/upload-model-to-dockerhub.yml index 4efb93d..f6f4926 100644 --- a/.github/workflows/upload-model-to-dockerhub.yml +++ b/.github/workflows/upload-model-to-dockerhub.yml @@ -36,6 +36,7 @@ jobs: fetch-depth: 0 # otherwise, you will failed to push refs to dest repo lfs: 'true' +# This might stop working in the future, so we need to keep an eye on it - name: Free Disk Space (Ubuntu) uses: jlumbroso/free-disk-space@main with: @@ -102,15 +103,12 @@ jobs: run: | ersilia -v fetch ${{ github.event.repository.name }} --from_dockerhub ersilia -v serve ${{ github.event.repository.name }} - ersilia -v run -i "CCCC" -o "output.json" - expected=$(jq '.[0].output.outcome[]' output.json | wc -l) - result=$(jq '.[0].output.outcome[] | select(. != null)' output.json | wc -l) - echo "Expected correct outcomes $expected" - echo "Returned correct outcomes $result" - if ! ([ $result -gt 0 ] && [ $result -le $expected ]) - then - echo "Error in model output, aborting build and push" - exit 1 + ersilia -v run -i "CCCC" -o "output.csv" + ersilia close + output=$(python .github/scripts/verify_model_outcome.py output.csv) + if echo "$output" | grep -q "All outcomes are null"; then + echo "Error in model outcome, aborting build" + exit 1 fi env: PULL_IMAGE: n