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}')
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")
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}')
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}')
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}')
def output(config: ServerConfig, uid: str): """ Logs the output reported from the ProcessMonitor. """ run_single_action_client(config.host, config.port, "output")
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)
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)