Running ExecutablesΒΆ
You can run any executable or script through Ganga using the Executable
application. This accepts either a full
path to an already installed exe (e.g. on CVMFS) or a Ganga File
object that will be sent with your job. You
can also supply arguments and environment settings with the options in the Executable
object.
As an example:
# Already existing Exe
j = Job()
j.application = Executable()
j.application.exe = '/bin/ls'
j.application.args = ['-l', '-h']
j.submit()
# Wait for completion
j.peek("stdout")
# Send a script
open('my_script.sh', 'w').write("""#!/bin/bash
echo 'Current dir: ' `pwd`
echo 'Contents:'
ls -ltr
echo 'Args: ' $@
""")
import os
os.system('chmod +x my_script.sh')
j = Job()
j.application = Executable()
j.application.exe = File('my_script.sh')
j.submit()
# Wait for completion
j.peek("stdout")
If your executable requires more than one file to run, you can use the inputfiles
field of the Job
object
to send this across as well (see Input And Output Data).