예제 #1
0
def read_host_info(host: str) -> dict:
    """ Read information of a remote host.

    Args:
        host: The host from which the info will be read.
    """
    from lazycluster import RuntimeTask
    from fabric import Connection
    import json
    task = RuntimeTask('get-host-info')
    task.run_command(get_pip_install_cmd())
    task.run_function(print_localhost_info)
    task.execute(Connection(host))
    runtime_info = json.loads(task.execution_log[2])
    runtime_info['host'] = host
    return runtime_info
예제 #2
0
def read_host_info(host: str) -> Dict[str, Union[str, List[str]]]:
    """Read information of a remote host.

    Args:
        host: The host from which the info will be read.
    """
    import json

    from fabric import Connection

    from lazycluster import RuntimeTask

    task = RuntimeTask("get-host-info")
    task.run_command(get_pip_install_cmd())
    task.run_function(print_localhost_info)
    task.execute(Connection(host))
    runtime_info = json.loads(task.execution_log[2])
    runtime_info["host"] = host
    return runtime_info