Skip to content

Commit

Permalink
updating readme [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
ersilia-bot committed Apr 16, 2024
1 parent 6244844 commit 1ff5a6c
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 11 deletions.
27 changes: 27 additions & 0 deletions .github/scripts/verify_model_outcome.py
Original file line number Diff line number Diff line change
@@ -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 <output_csv_file>')
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')

18 changes: 17 additions & 1 deletion .github/workflows/test-model-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
18 changes: 17 additions & 1 deletion .github/workflows/test-model.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
16 changes: 7 additions & 9 deletions .github/workflows/upload-model-to-dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1ff5a6c

Please sign in to comment.