Created
June 2, 2016 14:54
-
-
Save nicoulaj/91a18d5c0ed952cbd027bae53bbbedbd to your computer and use it in GitHub Desktop.
SGE -notify and -inherit
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
#!/bin/bash | |
# Trap signals | |
for signal in HUP INT QUIT ABRT KILL SEGV USR1 USR2 TERM; do | |
trap "echo 'master : Received signal ${signal}...'" ${signal} | |
done | |
# Submit slaves | |
slave_id=0; while read host slots queue procs; do | |
for slot in $(seq $slots); do | |
echo "Launching slave $(( ++slave_id ))..." | |
qrsh -V \ | |
-inherit \ | |
$host \ | |
${TEST_DIR}/test-slave.sh ${slave_id} \ | |
& | |
done | |
done < $PE_HOSTFILE | |
# Wait for slaves to be started | |
sleep 5 | |
# Kill own job | |
qdel $JOB_ID | |
# Print alive message every second | |
i=0; while sleep 1; do | |
echo "master : $(( ++i ))" | |
done |
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
#!/bin/bash | |
# Trap signals | |
for signal in HUP INT QUIT ABRT KILL SEGV USR1 USR2 TERM; do | |
trap "echo 'slave ${JOB_ID} : Received signal ${signal}...'" ${signal} | |
done | |
# Print alive message every second | |
i=0; while sleep 1; do | |
echo "slave ${1} : $(( ++i ))" | |
done |
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
#!/bin/bash | |
export TEST_QUEUE=test.q | |
export TEST_PE=test_pe | |
export TEST_SLAVES=4 | |
export TEST_MEMORY=1G | |
export TEST_DIR=$PWD | |
# Launch parallel job | |
qrsh -V \ | |
-notify \ | |
-now no \ | |
-q "${TEST_QUEUE}@*" \ | |
-pe ${TEST_PE} ${TEST_SLAVES} \ | |
-l s_vmem=${TEST_MEMORY} \ | |
${TEST_DIR}/test-master.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment