Ejemplo n.º 1
0

app.add_option(
     "--enable_chroot",
     dest="chroot",
     default=False,
     action='store_true',
     help="chroot tasks to the sandbox before executing them.")


app.add_option(
     "--port",
     type='string',
     nargs=1,
     action='callback',
     callback=add_port_to('prebound_ports'),
     dest='prebound_ports',
     default={},
     metavar = "NAME:PORT",
     help="bind a numbered port PORT to name NAME")


def get_task_from_options(opts):
  tasks = ThermosConfigLoader.load_json(opts.thermos_json)
  if len(tasks.tasks()) == 0:
    app.error("No tasks specified!")
  if len(tasks.tasks()) > 1:
    app.error("Multiple tasks in config but no task name specified!")
  task = tasks.tasks()[0]
  if not task.task.check().ok():
    app.error(task.task.check().message())
Ejemplo n.º 2
0
    "The path to the mesos-containerizer executable that will be used to isolate the task's "
    "filesystem (if using a filesystem image).")

app.add_option(
    "--preserve_env",
    dest="preserve_env",
    default=False,
    action='store_true',
    help=
    "Preserve thermos runners' environment variables for the task being run.")

app.add_option("--port",
               type='string',
               nargs=1,
               action='callback',
               callback=add_port_to('prebound_ports'),
               dest='prebound_ports',
               default={},
               metavar="NAME:PORT",
               help="bind a numbered port PORT to name NAME")

app.add_option(
    "--hostname",
    default=None,
    dest="hostname",
    help=
    "The hostname to advertise in ZooKeeper and the thermos observer instead of "
    "the locally-resolved hostname.")

app.add_option(
    '--process_logger_destination',
Ejemplo n.º 3
0
                    help="run as this user.  if not $USER, must have setuid privilege.")
@app.command_option("--enable_chroot", dest="chroot", default=False, action='store_true',
                    help="chroot tasks to the sandbox before executing them, requires "
                    "root privileges.")
@app.command_option("--task", metavar="TASKNAME", default=None, dest='task',
                    help="The thermos task within the config that should be run. Only required if "
                    "there are multiple tasks exported from the thermos configuration.")
@app.command_option("--task_id", metavar="STRING", default=None, dest='task_id',
                    help="The id to which this task should be bound, synthesized from the task "
                    "name if none provided.")
@app.command_option("--json", default=False, action='store_true', dest='json',
                    help="Read the source file in json format.")
@app.command_option("--sandbox", metavar="PATH", default="/var/lib/thermos/sandbox", dest='sandbox',
                    help="The sandbox in which to run the task.")
@app.command_option("-P", "--port", type="string", nargs=1, action="callback",
                    callback=add_port_to('prebound_ports'), dest="prebound_ports", default=[],
                    metavar="NAME:PORT", help="bind named PORT to NAME.")
@app.command_option("-E", "--environment", type="string", nargs=1, action="callback",
                    callback=add_binding_to('bindings'), default=[], dest="bindings",
                    metavar="NAME=VALUE",
                    help="bind the configuration environment variable NAME to VALUE.")
@app.command_option("--daemon", default=False, action='store_true', dest='daemon',
                    help="fork and daemonize the thermos runner.")
def run(args, options):

  """Run a thermos task.

    Usage: thermos run [options] config
    Options:
      --user=USER		   run as this user.  if not $USER, must have setuid privilege.
      --enable_chroot		   chroot into the sandbox for this task, requires superuser
Ejemplo n.º 4
0
    "--json", default=False, action="store_true", dest="json", help="Read the source file in json format."
)
@app.command_option(
    "--sandbox",
    metavar="PATH",
    default="/var/lib/thermos/sandbox",
    dest="sandbox",
    help="The sandbox in which to run the task.",
)
@app.command_option(
    "-P",
    "--port",
    type="string",
    nargs=1,
    action="callback",
    callback=add_port_to("prebound_ports"),
    dest="prebound_ports",
    default=[],
    metavar="NAME:PORT",
    help="bind named PORT to NAME.",
)
@app.command_option(
    "-E",
    "--environment",
    type="string",
    nargs=1,
    action="callback",
    callback=add_binding_to("bindings"),
    default=[],
    dest="bindings",
    metavar="NAME=VALUE",