示例#1
0
def _attach(task, no_stdin=False):
    """ Attach the stdin/stdout/stderr of the CLI to the
    STDIN/STDOUT/STDERR of a running task.

    :param task: task ID pattern to match
    :type task: str
    :param no_stdin: True if we should *not* attach stdin,
                     False if we should
    :type no_stdin: bool
    :rtype int
    """

    task_io = mesos.TaskIO(task)
    return task_io.attach(no_stdin)
示例#2
0
def _exec(task, cmd, args=None, interactive=False, tty=False):
    """ Launch a process inside a container with the given <task_id>

    :param task: task ID pattern to match
    :type task: str
    :param cmd: The command to launch inside the task's container
    :type args: cmd
    :param args: Additional arguments for the command
    :type args: list
    :param interactive: attach stdin
    :type interactive: bool
    :param tty: attach a tty
    :type tty: bool
    :returns: process return code
    :rtype int
    """

    task_io = mesos.TaskIO(task)
    return task_io.exec(cmd, args, interactive, tty)