π Model Inference Run π€ eos2re5: ADMETlab models for evaluation of drug candidates π 2025-01-28 #252
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: Model Inference Run | |
on: | |
issues: | |
types: [ "opened" ] | |
jobs: | |
predict-model: | |
if: github.event.issue.labels[0].name == 'model-inference-run' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Issue Forms Body Parser | |
id: parse | |
uses: zentered/issue-forms-body-parser@v2.0.0 | |
- name: Update Issue title | |
run: | | |
gh repo clone ersilia-os/ersilia-self-service | |
MODEL_NAME=$(echo '${{ steps.parse.outputs.data }}' | jq -r '.model.text' | awk -F' - ' '{print $1}') | |
MODEL_ID=$(echo '${{ steps.parse.outputs.data }}' | jq -r '.model.text' | awk -F' - ' '{print $2}') | |
CURRENT_DATE=$(date +'%Y-%m-%d') | |
cd ersilia-self-service | |
gh issue edit ${{ github.event.issue.number }} --title "π Model Inference Run π€ $MODEL_ID: $MODEL_NAME π $CURRENT_DATE" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v4 | |
with: | |
repository: ersilia-os/ersilia | |
- name: Set up Python 3.11 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install Ersilia | |
run: | | |
python -m pip install git+https://github.com/ersilia-os/bentoml-ersilia.git | |
python -m pip install -e . | |
- name: Test help command | |
run: | | |
ersilia --help | |
ersilia --version | |
- name: Model Inference Run | |
id: model-inference-run | |
continue-on-error: true | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_SPLUNK }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_SPLUNK }} | |
run: | | |
MODEL_ID=$(echo '${{ steps.parse.outputs.data }}' | jq -r '.model.text' | awk -F' - ' '{print $2}') | |
ersilia -v fetch $MODEL_ID --from_dockerhub | |
ersilia -v serve $MODEL_ID --track | |
echo "smiles" > input.csv | |
echo '${{ steps.parse.outputs.data }}' | jq -r '.molecules.text' >> input.csv | |
echo "Predicting output for input.csv file using model $MODEL_ID" | |
ersilia -v run -i "input.csv" -o "output.csv" | |
ersilia -v close | |
- name: Upload output to GitHub | |
id: upload-artifact | |
if: steps.model-inference-run.outcome == 'success' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Model Inference Run | |
path: output.csv | |
retention-days: 30 | |
- name: Add success comment | |
id: success-comment | |
if: steps.model-inference-run.outcome == 'success' | |
run: gh issue comment "$NUMBER" --body "$BODY" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_REPO: ${{ github.repository }} | |
NUMBER: ${{ github.event.issue.number }} | |
BODY: > | |
Greetings @${{ github.event.issue.user.login }}! | |
We have successfully completed your model inference run. You can download your results [here](${{ steps.upload-artifact.outputs.artifact-url }}) | |
Please note that these results will only be available for 30 days after which they will be removed and this issue closed. | |
- name: Add failure comment | |
id: failure-comment | |
if: steps.model-inference-run.outcome == 'failure' | |
run: gh issue comment "$NUMBER" --body "$BODY" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_REPO: ${{ github.repository }} | |
NUMBER: ${{ github.event.issue.number }} | |
BODY: > | |
Greetings @${{ github.event.issue.user.login }}! | |
We encountered an error while running this model. Rest assured that we are working on resolving this issue. We will update you as soon as we have more information. | |
If you need further assistance, please feel free to reach out to us. |