Skip to content

[LAB-577] Plex upgrade to 0.10.0 #626

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions infrastructure/ansible/files/colabfold_mini_canary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,25 @@
# exit the whole script if any command returns a non-zero exit code
set -e

# IFPS Custom setup
export IPFS_PATH=$(mktemp -d)
export BACALHAU_SERVE_IPFS_PATH=${IPFS_PATH}
export LOGFILE={{ repo_dir }}/plex_colabfold_out.log

# Ensure there is no port conflict with other canaries
ipfs init -e
ipfs bootstrap rm --all
ipfs config Addresses.API /ip4/127.0.0.1/tcp/8001
ipfs config Addresses.Gateway /ip4/127.0.0.1/tcp/8002
ipfs config Addresses.Swarm --json '["/ip4/0.0.0.0/tcp/8000"]'
export BACALHAU_IPFS_SWARM_ADDRESSES="/dns4/bacalhau.labdao.xyz/tcp/4001/p2p/$(curl -s -X POST bacalhau.labdao.xyz:5001/api/v0/id | jq -r '.ID')"

# plex must run from the same place as tools directory
cd {{ repo_dir }}
touch ${LOGFILE}
echo "$(date) - Running Canary" | tee -a ${LOGFILE}

plex init -t {{ repo_dir }}/tools/colabfold-mini.json -i '{"sequence": ["{{ repo_dir }}/testdata/folding/test.fasta"]}' --scatteringMethod=dotProduct --autoRun=true -a test -a cron | tee plex_colabfold_out.log
plex init -t {{ repo_dir }}/tools/colabfold-mini.json -i '{"sequence": ["{{ repo_dir }}/testdata/folding/test.fasta"]}' --scatteringMethod=dotProduct --autoRun=true -a test -a cron | tee -a ${LOGFILE}
# capture the exit status of the plex call
plex_result_code=${PIPESTATUS[0]}
# exit immediately if plex exited with an error
Expand All @@ -15,7 +30,7 @@ if [ $plex_result_code -gt 0 ]; then
fi

# parse the output directory from the plex stdout
result_dir=$(cat plex_colabfold_out.log | grep 'Finished processing, results written to' | sed -n 's/^.*Finished processing, results written to //p' | sed 's/\/io.json//')
result_dir=$(cat ${LOGFILE} | grep -a 'Finished processing, results written to' | sed -n 's/^.*Finished processing, results written to //p' | sed 's/\/io.json//' | tail -n 1)

# exit if no docked files are found
cd "$result_dir/entry-0/outputs"
Expand All @@ -30,4 +45,6 @@ rm -rf $result_dir

curl -X POST -H "Authorization: Bearer ${HEII_ON_CALL_API_KEY}" https://api.heiioncall.com./triggers/991a6388-5c61-422c-b8cf-202b4c4b55a6/checkin

echo "Colabfold mini canary success"
echo "$(date) - Colabfold mini canary success" | tee -a ${LOGFILE}

rm -rf ${IPFS_PATH}
24 changes: 21 additions & 3 deletions infrastructure/ansible/files/equibind_canary.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,26 @@
# exit the whole script if any command returns a non-zero exit code
set -e

# IFPS Custom setup
export IPFS_PATH=$(mktemp -d)
export BACALHAU_SERVE_IPFS_PATH=${IPFS_PATH}
export LOGFILE={{ repo_dir }}/plex_equibind_out.log

# Ensure there is no port conflict with other canaries
ipfs init -e
ipfs bootstrap rm --all
ipfs config Addresses.API /ip4/127.0.0.1/tcp/7001
ipfs config Addresses.Gateway /ip4/127.0.0.1/tcp/7002
ipfs config Addresses.Swarm --json '["/ip4/0.0.0.0/tcp/7000"]'
export BACALHAU_IPFS_SWARM_ADDRESSES="/dns4/bacalhau.labdao.xyz/tcp/4001/p2p/$(curl -s -X POST bacalhau.labdao.xyz:5001/api/v0/id | jq -r '.ID')"

# plex must run from the same place as tools directory
cd {{ repo_dir }}

plex init -t {{ repo_dir }}/tools/equibind.json -i '{"protein": ["{{ repo_dir }}/testdata/binding/abl/7n9g.pdb"], "small_molecule": ["{{ repo_dir }}/testdata/binding/abl/ZINC000003986735.sdf"]}' --scatteringMethod=dotProduct -a test -a cron --autoRun=true 2>&1 | tee plex_equibind_out.log
touch ${LOGFILE}
echo "$(date) - Running Canary" | tee -a ${LOGFILE}

plex init -t {{ repo_dir }}/tools/equibind.json -i '{"protein": ["{{ repo_dir }}/testdata/binding/abl/7n9g.pdb"], "small_molecule": ["{{ repo_dir }}/testdata/binding/abl/ZINC000003986735.sdf"]}' --scatteringMethod=dotProduct -a test -a cron --autoRun=true 2>&1 | tee -a ${LOGFILE}
# capture the exit status of the plex call
plex_result_code=${PIPESTATUS[0]}
# exit immediately if plex exited with an error
Expand All @@ -15,7 +31,7 @@ if [ $plex_result_code -gt 0 ]; then
fi

# parse the output directory from the plex stdout
result_dir=$(cat plex_equibind_out.log | grep 'Finished processing, results written to' | sed -n 's/^.*Finished processing, results written to //p' | sed 's/\/io.json//')
result_dir=$(cat ${LOGFILE} | grep -a 'Finished processing, results written to' | sed -n 's/^.*Finished processing, results written to //p' | sed 's/\/io.json//' | tail -n 1)

# exit if no docked files are found
cd "$result_dir/entry-0/outputs"
Expand All @@ -30,4 +46,6 @@ rm -rf $result_dir

curl -X POST -H "Authorization: Bearer ${HEII_ON_CALL_API_KEY}" https://api.heiioncall.com./triggers/a7660c2f-5262-4392-918b-d98aee244890/checkin

echo "Canary success"
echo "$(date) - Canary success" | tee -a ${LOGFILE}

rm -rf ${IPFS_PATH}
6 changes: 6 additions & 0 deletions infrastructure/ansible/provision_canary.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
repo_dir: "{{ canary_dir }}/repo"
binary_dir: "{{ canary_dir }}/binary"
tasks:
# Must provide limit flag to ensure running against current environment
- fail:
msg: "you must use -l or --limit"
when: ansible_limit is not defined
run_once: true

- name: Run common tasks
ansible.builtin.include_tasks: tasks/common_tasks.yaml

Expand Down
4 changes: 4 additions & 0 deletions infrastructure/ansible/tasks/common_tasks.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
- name: "Gather service facts"
become: true
ansible.builtin.service_facts:

- name: "Disable unattended upgrades service"
become: true
ansible.builtin.systemd:
name: "unattended-upgrades.service"
enabled: false
Expand Down Expand Up @@ -31,4 +33,6 @@
become: true
ansible.builtin.pip:
name:
- pip
- boto3
- pyopenssl
10 changes: 7 additions & 3 deletions infrastructure/ansible/tasks/install_plex_tasks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
become: true
ansible.builtin.pip:
name:
- pip
- pyopenssl
- github3.py

- name: Print plex_version if provided
ansible.builtin.debug:
msg: "{{ plex_version }}"
when: plex_version is defined

- name: Get the latest plex release
community.general.github_release:
repo: plex
Expand All @@ -17,8 +20,9 @@
- name: Download the latest plex binary
ansible.builtin.get_url:
#https://github.com/labdao/plex/releases/download/v0.7.0/plex_0.7.0_linux_amd64.tar.gz
url: https://github.com/labdao/plex/releases/download/{{ latest_release.tag }}/plex_{{ latest_release.tag | regex_replace('^v([0-9]\.[0-9]\.[0-9])$', '\1') }}_linux_amd64.tar.gz
url: https://github.com/labdao/plex/releases/download/{{ latest_release.tag }}/plex_{{ latest_release.tag | regex_replace('^v([0-9]\.[0-9][0-9]\.[0-9])$', '\1') }}_linux_amd64.tar.gz
dest: /tmp/plex_release.tar.gz
force: true

- name: Unzip the plex release
ansible.builtin.unarchive:
Expand Down
Binary file added tools/.equibind.json.swp
Binary file not shown.