@@ -125,18 +125,43 @@ This directory can be changed by specifying:
has finished.
In case, SGE backend is used, `--sge-extra-command` or shortly `-e` allows you to send commands to `qsub -l` command
If the SGE backend is used, ``--sge-extra-args`` or shortly ``-e`` allows you to send
extra arguments to ``qsub``.
.. code-block:: sh
$ jman -vv submit -l [log_dir] -e [SGE_command]
$ jman -vv submit -e="<sge_extra_args>"
For example, `jman submit .. -e pytorch=true ...` will be translated to `qsub ... -l pytorch=true ...`.
For example, ``jman submit .. -e="-P project_name -l pytorch" -- ...`` will be
translated to ``qsub ... -P project_name -l pytorch -- ...``.
.. note::
Note that you can pass multiple SGE commands with `--sge-extra-command` or `e`, e.g., `jman submit ... -e <SGE_command_1> <SGE_command_2> <SGE_command_3> ...`
Note that extra options for qsub must be wrapped in single or double quotes **and**
should attach to the ``-e`` option with an ``=`` sign, e.g. ``jman submit -e='-P
submit_parser=cmdparser.add_parser('submit',aliases=['sub'],formatter_class=formatter,help='Submits jobs to the SGE queue or to the local job scheduler and logs them in a database.')
submit_parser.add_argument('-q','--queue',metavar='QNAME',dest='qname',default='all.q',choices=QUEUES,help='the name of the SGE queue to submit the job to')
submit_parser.add_argument('-e','--sge-extra-command',default=[],type=str,nargs="*",help='In case SGE backend is used, this option allows you to send commands to `qsub -l`, e.g., `jman submit -e pytorch=true` will be translated to `qsub -l pytorch=true`')
submit_parser.add_argument('-e','--sge-extra-args',default=rc.get('gridtk.sge.extra.args.default',''),type=str,help='Passes extra arguments to qsub. See the documentation of the package for usage and ways of overriding default behavior.')
submit_parser.add_argument('-m','--memory',help='Sets both the h_vmem and the mem_free parameters when submitting '
'the job to a non-GPU queue, e.g., 8G to set the memory '
'requirements to 8 gigabytes. Sets gpumem parameter when '
Use this flag if your process will need a lot of Input/Output operations.
sge_extra_flags
This is used to add new flags which are developed by SGE admin.
Note that you can pass multiple SGE commands with `--sge-extra-command` or `e`, e.g., `jman submit ... -e <SGE_command_1> <SGE_command_2> <SGE_command_3> ...` which will be translated to `qsub ... -l <SGE_command_1> -l <SGE_command_2> -l <SGE_command_3> ...`
sge_extra_args
This is used to send extra argument to SGE. Note that all its arguments are directly
used in `qsub` command. For example, `jman submit -e "-P project_name -l pytorch=true" -- ...` will
be translated to `qsub -P project_name -l pytorch=true -- ...`
Returns the job id assigned to this job (integer)
"""
import six
from bob.extension import rc
scmd = ['qsub']
scmd += list(itertools.chain(*[['-l', f'{e}'] for e in sge_extra_flags]))
import six
prepend = rc.get('gridtk.sge.extra.args.prepend') or ""
sge_extra_args = f"{prepend} {sge_extra_args or ''}"
scmd += shlex.split(sge_extra_args)
if isinstance(queue, six.string_types) and queue not in ('all.q', 'default'):