Пример #1
0
def remove(config: ServerConfig, uid: str):
    """
    Removes the process with the given unique id.
    """
    result = run_single_action_client(config.host,
                                      config.port,
                                      "remove",
                                      uid=uid)
    click.echo(f'Remove command {uid} -> {result}')
Пример #2
0
def list_processes(config: ServerConfig, as_json):
    """
    Lists all processes.
    """
    data = run_single_action_client(config.host, config.port, "list")
    if data is not None:
        result = json.dumps(data, indent=True)
        click.echo(result)
    else:
        click.echo("No processes could be retrieved")
Пример #3
0
def action(config: ServerConfig, action: str, project: str, uid: str):
    """
    Sends the given action command.
    """
    result = run_single_action_client(config.host,
                                      config.port,
                                      action,
                                      uid=uid,
                                      project=project)
    click.echo(f'Action "{action}" -> {result}')
Пример #4
0
def start(config: ServerConfig, uid: str):
    """
    Starts the process with the given unique id.
    """
    kwargs = get_context_kwargs()

    result = run_single_action_client(config.host,
                                      config.port,
                                      "start",
                                      uid=uid,
                                      command_kwargs=kwargs)
    click.echo(f'Start "{uid} ({kwargs})" -> {result}')
Пример #5
0
def add(config: ServerConfig, uid: str, cmd: str, as_group: bool):
    """
    Adds a new process with the given unique id and executes the specified command once started.
    """
    kwargs = get_context_kwargs()
    result = run_single_action_client(config.host,
                                      config.port,
                                      "add",
                                      uid=uid,
                                      cmd=cmd,
                                      group=as_group,
                                      command_kwargs=kwargs)
    click.echo(f'Add command {uid}="{cmd}" group={as_group} -> {result}')
Пример #6
0
def output(config: ServerConfig, uid: str):
    """
    Logs the output reported from the ProcessMonitor.
    """
    run_single_action_client(config.host, config.port, "output")
Пример #7
0
def stop(config: ServerConfig, uid: str):
    """
    Stops the process with the given unique id.
    """
    click.echo(f'Stop {uid}')
    run_single_action_client(config.host, config.port, "stop", uid=uid)
Пример #8
0
def restart(config: ServerConfig, uid: str):
    """
    Re-starts the process with the given unique id.
    """
    click.echo(f'Re-start {uid}')
    run_single_action_client(config.host, config.port, "restart", uid=uid)