def submit(cluster_config_file, screen, tmux, stop, start, cluster_name, port_forward, script, script_args): """Uploads and runs a script on the specified cluster. The script is automatically synced to the following location: os.path.join("~", os.path.basename(script)) """ assert not (screen and tmux), "Can specify only one of `screen` or `tmux`." if start: create_or_update_cluster(cluster_config_file, None, None, False, False, True, cluster_name) target = os.path.join("~", os.path.basename(script)) rsync(cluster_config_file, script, target, cluster_name, down=False) cmd = " ".join(["python", target] + list(script_args)) exec_cluster(cluster_config_file, cmd, screen, tmux, stop, False, cluster_name, port_forward) if tmux or screen: attach_command_parts = ["ray attach", cluster_config_file] if cluster_name is not None: attach_command_parts.append( "--cluster-name={}".format(cluster_name)) if tmux: attach_command_parts.append("--tmux") elif screen: attach_command_parts.append("--screen") attach_command = " ".join(attach_command_parts) attach_info = "Use `{}` to check on command status.".format( attach_command) logger.info(attach_info)
def exec_cmd(cluster_config_file, cmd, screen, tmux, stop, start, cluster_name, port_forward): assert not (screen and tmux), "Can specify only one of `screen` or `tmux`." exec_cluster(cluster_config_file, cmd, screen, tmux, stop, start, cluster_name, port_forward) if tmux or screen: attach_command_parts = ["ray attach", cluster_config_file] if cluster_name is not None: attach_command_parts.append( "--cluster-name={}".format(cluster_name)) if tmux: attach_command_parts.append("--tmux") elif screen: attach_command_parts.append("--screen") attach_command = " ".join(attach_command_parts) attach_info = "Use `{}` to check on command status.".format( attach_command) logger.info(attach_info)
def exec_cmd(cluster_config_file, cmd, docker, screen, tmux, stop, start, cluster_name, port_forward): exec_cluster(cluster_config_file, cmd, docker, screen, tmux, stop, start, cluster_name, port_forward)
def exec_cmd(cluster_config_file, cmd, docker, screen, tmux, stop, start, cluster_name, port_forward): """Execute a command via SSH on a Ray cluster.""" port_forward = [(port, port) for port in list(port_forward)] exec_cluster(cluster_config_file, cmd, docker, screen, tmux, stop, start, cluster_name, port_forward)
def exec_cmd(cluster_config_file, cmd, docker, screen, tmux, stop, start, cluster_name, port_forward): port_forward = [(port, port) for port in list(port_forward)] exec_cluster(cluster_config_file, cmd, docker, screen, tmux, stop, start, cluster_name, port_forward)