I had previously reworked this CLI stuff to work with LWR - this changeset brings those changes back to Galaxy. This version has the advantage of using the job script module so GALAXY_SLOTS, job_conf.xml defined environment tweaks, and job metrics should all be usable now with the CLI runner. This version also has a local shell variant (to eliminate the need use of SSH and run qsub directly on the same machine) which is nowthe default if not shell_plugin is defined and a variant of the Torque executor to target slurm's torque compatibility executables (slurm's qstat doesn't support -x), as well as some other small bug fixes.
The comment "set arbitrary environment variables at runtime - like metrics doesn't yet work with local or CLI runners. But should work with DRMAA/SLURM, PBS, Condor, and LWR." in job_conf.xml.sample_advanced should probably be updated accordingly.