-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: universal running instructions
- Loading branch information
Showing
3 changed files
with
40 additions
and
27 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,17 @@ | ||
## How to run a batch job | ||
|
||
Set up: | ||
```bash | ||
# Prepare and upload config. | ||
python3 eqtl_catalogue.py > config.json | ||
# Upload the script. | ||
gsutil cp eqtl_catalogue.py gs://genetics_etl_python_playground/batch/eqtl_catalogue/eqtl_catalogue.py | ||
gsutil cp eqtl_catalogue.sh gs://genetics_etl_python_playground/batch/eqtl_catalogue/eqtl_catalogue.sh | ||
# Submit the batch job. | ||
export MODULE=eqtl_catalogue | ||
``` | ||
|
||
Run: | ||
```bash | ||
# Upload code. | ||
gsutil -m cp -r . gs://genetics_etl_python_playground/batch/code | ||
# Submit batch job. | ||
gcloud batch jobs submit \ | ||
eqtl-catalogue24 \ | ||
--config config.json \ | ||
"${MODULE}-$(date --utc +"%Y%m%d-%H%M%S")" \ | ||
--config <(python3 ${MODULE}.py) \ | ||
--location europe-west1 | ||
``` |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
export MODULE=$1 | ||
|
||
# Create directory for logs, if necessary. | ||
mkdir -p /mnt/share/logs/$MODULE | ||
|
||
# Redirect all subsequent logs. | ||
# The $BATCH_TASK_INDEX variable is set by Google Batch. | ||
exec &> /mnt/share/logs/$MODULE/log.$BATCH_TASK_INDEX.log | ||
|
||
echo ">>> Update APT" | ||
sudo apt -y update | ||
|
||
echo ">>> Install packages" | ||
sudo apt -y install python3 python3-pip python3-setuptools | ||
|
||
echo ">>> Update PIP and setuptools" | ||
sudo python3 -m pip install --upgrade pip setuptools | ||
echo $? | ||
|
||
echo ">>> Install packages" | ||
sudo python3 -m pip install -r /mnt/share/code/requirements.tt | ||
echo $? | ||
|
||
echo ">>> Run script" | ||
sudo python3 /mnt/share/code/${MODULE}.py ${BATCH_TASK_INDEX} | ||
|
||
echo ">>> Completed" | ||
echo $? |