예제 #1
0
def simplerun(args, options):
  """Run a simple command line as a thermos task.

    Usage: thermos simplerun [options] [--] commandline
  """
  try:
    cutoff = args.index('--')
    cmdline = ' '.join(args[cutoff + 1:])
  except ValueError:
    cmdline = ' '.join(args)

  print("Running command: '%s'" % cmdline)

  thermos_task = ThermosTaskWrapper(Task(
    name=options.name,
    resources=Resources(cpu=1.0, ram=256 * 1024 * 1024, disk=0),
    processes=[Process(name=options.name, cmdline=cmdline)]))

  really_run(thermos_task,
             options.root,
             tempfile.mkdtemp(),
             task_id=options.task_id,
             user=options.user,
             prebound_ports=options.prebound_ports,
             chroot=False,
             daemon=options.daemon)
예제 #2
0
파일: run.py 프로젝트: isabella232/client-3
def run(args, options):

  """Run a thermos task.

    Usage: thermos run [options] config
  """
  thermos_task = get_task_from_options(args, options)
  really_run(thermos_task,
             options.root,
             options.sandbox,
             task_id=options.task_id,
             user=options.user,
             prebound_ports=options.prebound_ports,
             chroot=options.chroot,
             daemon=options.daemon)