Hi all,
Attached is a patch that allows galaxy to qsub jobs as different users. It's just a proof-of-concept, but it works.
The changes to Galaxy are minimal: instead of calling "drmaa.session.runJob(JobTemplate)", it saves the jobTemplate parameters to a file, the run (with sudo) a small scripts that changes the real user-id and then calls 'qsub'. from there on, galaxy picks-up the JobID, and continues as usual.
Note that the logic to actually select which user to use is not implemented, the method get_qsub_user() in drmaa.py always returns the current user, but one can change it to run as a different user (or implement a more sophisticated mechanism, as I plan to).
To try this out: 1. import the patch 2. edit your 'universe_wsgi.ini' and add "drmaa_external_runjob_script" key (see "universe_wsgi.ini.sample") 3. edit /etc/sudoers to allow the script (drmaa_external_runner.py) to run as root without asking for password, by adding a line similar to this: gordon ALL = (root) NOPASSWD: SETENV: /data/hannon/gordon/galaxy/galaxy_dev_external_qsub/scripts/drmaa_external_runner.py
Also available here: http://cancan.cshl.edu/labmembers/gordon/files/galaxy_drmaa_setuid_2010_08_0...
comments are welcomed, -gordon
P.S. This was tested only on SGE 6.2 and CentOS linux. Other machines may have a slighly different 'sudo' (I use "sudo -E -S"), and other DRMAAs might not work.
galaxy-dev@lists.galaxyproject.org