Skip to content

Instantly share code, notes, and snippets.

@DarwinAwardWinner
Last active November 9, 2020 20:43
Show Gist options
  • Save DarwinAwardWinner/8a631d897d45f005528a to your computer and use it in GitHub Desktop.
Save DarwinAwardWinner/8a631d897d45f005528a to your computer and use it in GitHub Desktop.
Put bash cluster setup code and python script in a single file
#!/bin/bash
# -*- mode:python -*-
#PBS -l nodes=1:ppn=8,mem=30gb
''''/bin/true
# This is bash code to set up the environment
echo "Hello from bash!"
echo "Args are: $@"
# Bash setup code ends here
python - "$@" <<EOF
''' # Python starts here '''
print "Hello from Python!"
import sys
print "Args are:", sys.argv[1:]
# End Python code
EOF = None
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment