Commit 3c3f1a36 authored by André Anjos's avatar André Anjos 💬

Remove old-style torch5spro stuff

parent 51554077
......@@ -21,7 +21,7 @@ from cPickle import dumps
import argparse
from ..manager import JobManager
from ..tools import make_shell, make_python_wrapper, make_torch_wrapper, random_logdir
from ..tools import make_shell, random_logdir
def setup(args):
"""Returns the JobManager and sets up the basic infrastructure"""
......@@ -125,19 +125,6 @@ def pysubmit(args):
args.job = make_shell(sys.executable, args.job)
submit(args)
def wsubmit(args):
"""Wrapped submission"""
args.job = make_python_wrapper(args.wrapper, args.job)
submit(args)
def tsubmit(args):
"""Torch5spro-based submission"""
args.job, env = make_torch_wrapper(args.torch, args.torch_debug, args.job)
args.env.insert(0, env)
submit(args)
def explain(args):
"""Explain action"""
......@@ -308,25 +295,6 @@ def main():
pysubparser.set_defaults(func=pysubmit)
pysubparser.add_argument('job', metavar='command', nargs='+')
# subcommand 'wsubmit'
wsubparser = cmdparser.add_parser('wsubmit', aliases=['wsub', 'wrapper'],
help='submits a job that will be executed inside the context of a python wrapper script - note the wrapper script will be considered the SGE job and the actual prefixed command just an option; the wrapper script must be able to run and self-configure using stock components available in the OS')
add_submission_options(wsubparser)
wsubparser.set_defaults(func=wsubmit)
wsubparser.add_argument('-w', '--wrapper', metavar='WRAPPER', dest='wrapper',
help='the python wrapper that will bracket the script execution and options')
wsubparser.add_argument('job', metavar='command', nargs='+')
# subcommand 'torch'
tsubparser = cmdparser.add_parser('tsubmit', aliases=['tsub', 'torch'],
help='submits a job that will be executed inside the context of a torch release')
add_submission_options(tsubparser)
tsubparser.set_defaults(func=tsubmit)
tsubparser.add_argument('-T', '--torch', '--torch-root', metavar='DIR',
default='/idiap/group/torch5spro/nightlies/last', help='the root directory of a valid torch installation (defaults to %(default)s)')
tsubparser.add_argument('-D', '--torch-debug', dest='torch_debug', default=False, action='store_true', help='if set I\'ll setup the torch environment in debug mode')
tsubparser.add_argument('job', metavar='command', nargs='+')
# subcommand 'resubmit'
resubparser = cmdparser.add_parser('resubmit', aliases=['resub', 're'],
help='resubmits all jobs in a given database, exactly like they were submitted the first time')
......
......@@ -212,62 +212,6 @@ def make_shell(shell, command):
return ('-S', shell) + tuple(command)
def make_python_wrapper(wrapper, command):
"""Returns a single command given a python wrapper and a command to be
qsub'ed by that wrapper.
Keyword parameters:
wrapper
This is the python wrapper to be used for prefixing the environment in
which the **command** will execute. This parameter must be either a path to
the wrapper or a list with the wrapper and **wrapper** command options.
command
The script path to be submitted
Returns the wrapper command to be supplied to qsub()
"""
if not isinstance(wrapper, (list, tuple)): wrapper = [wrapper]
if not isinstance(command, (list, tuple)): command = [command]
return make_shell('/usr/bin/python', wrapper + command)
def make_torch_wrapper(torch, debug, command):
"""Submits a command using the Torch python wrapper so the **command**
executes in a valid Torch context.
Keyword parameters: (please read the help of qsub())
(read the help of qsub() for details on extra arguments that may be
supplied)
torch
This is the root directory for the torch installation you would like to use
for wrapping the execution of **command**.
debug
If set, this flag will switch the torch libraries to debug versions with
symbols loaded.
command
The script path to be submitted
Returns the command and environment parameters to be supplied to qsub()
"""
binroot = os.path.join(torch, 'bin')
shell = os.path.join(binroot, 'shell.py')
if not os.path.exists(shell):
raise RuntimeError, 'Cannot locate wrapper "%s"' % shell
wrapper = [shell]
if debug: wrapper += ['--debug']
env = 'OVERWRITE_TORCH5SPRO_BINROOT=%s' % binroot
return make_python_wrapper(wrapper, command), env
def qstat(jobid, context='grid'):
"""Queries status of a given job.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment