Skip to content

Instantly share code, notes, and snippets.

@tthyer
Last active September 9, 2020 20:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tthyer/3d867adce99bfc5f910b9f5778cf822b to your computer and use it in GitHub Desktop.
Save tthyer/3d867adce99bfc5f910b9f5778cf822b to your computer and use it in GitHub Desktop.
Toil K8S experiment job
apiVersion: batch/v1
kind: Job
metadata:
# It is good practice to include your username in your job name.
# Also specify it in TOIL_KUBERNETES_OWNER
name: tthyer-toil-rna-seq-test
spec:
# Do not try and rerun the leader job if it fails
backoffLimit: 0
template:
spec:
restartPolicy: Never
serviceAccountName: default
volumes:
- name: synapse-secret-volume
secret:
secretName: synapse-config
containers:
- name: main
image: quay.io/tessthyer/toil:4.1.0a1-23a56ee84a4e43f9ea8e2730d5969f71b27774c9-py3.7
imagePullPolicy: Always
volumeMounts:
- name: synapse-secret-volume
readOnly: true
mountPath: "/tmp/.synapseConfig"
subPath: ".synapseConfig"
env:
# Specify your username for inclusion in job names
- name: TOIL_KUBERNETES_OWNER
value: tthyer
- name: SYNAPSE_SECRET_NAME
value: synapse-config
resources:
# Make sure to set these resource limits to values large enough
# to accomodate the work your workflow does in the leader
# process, but small enough to fit on your cluster.
#
# Since no request values are specified, the limits are also used
# for the requests.
limits:
cpu: 2
memory: "4Gi"
ephemeral-storage: "10Gi"
command:
- /bin/bash
- -c
- |
# This Bash script will set up Toil and the workflow to run, and run them.
set -e
# We make sure to create a work directory; Toil can't hot-deploy a
# script from the root of the filesystem, which is where we start.
mkdir /tmp/work
cd /tmp/work
# We make a virtual environment to allow workflow dependencies to be
# hot-deployed.
#
# We don't really make use of it in this example, but for workflows
# that depend on PyPI packages we will need this.
#
# We use --system-site-packages so that the Toil installed in the
# appliance image is still available.
virtualenv --python python3 --system-site-packages venv
. venv/bin/activate
# Now clone the dockstore-workflow-rnaseq git repository
git clone https://github.com/tthyer/dockstore-workflow-rnaseq.git
cd dockstore-workflow-rnaseq
git checkout toil-k8s-experiment
# Now we run the workflow
#./utils/run-toil.py jobs/test-paired-bam
mkdir -p /var/log/toil/workers/def
toil-cwl-runner \
--batchSystem kubernetes \
--jobStore aws:us-east-1:tthyer-toil-k8s-test-def \
--logLevel DEBUG \
--logFile /var/log/toil/def.log \
--writeLogs /var/log/toil/workers/def \
--targetTime 1 \
--defaultDisk 400G \
--nodeTypes m5.4xlarge \
--maxNodes 3 \
--nodeStorage 400 \
--destBucket s3://tthyer-toil-k8s-test-out \
--rescueJobsFrequency 9000 \
--preserve-entire-environment \
--retryCount 0 \
bam_paired.cwl jobs/test-paired-bam/job.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment