definition, description="Show the log output of a remote SKIRT simulation") # ----------------------------------------------------------------- # Create and setup the remote remote = Remote() remote.setup(config.remote) # Open the simulation simulation = get_simulation_for_host(config.remote, config.id) # The name of the ski file (the simulation prefix) ski_name = simulation.prefix() # The path to the simulation log file remote_log_file_path = simulation.remote_log_file_path # Check whether the log file exists if not remote.is_file(remote_log_file_path): raise RuntimeError("The log file does not exist remotely") # Read the log file lines = remote.read_lines(remote_log_file_path) # Print the lines of the log file for line in lines: print(line) # -----------------------------------------------------------------
# ----------------------------------------------------------------- # Create and setup the remote remote = Remote() remote.setup(config.remote) # Open the task task_path = fs.join(introspection.pts_run_dir, config.remote, str(config.id) + ".task") task = Task.from_file(task_path) # Check whether the log file is present log_output_path = task.remote_log_path log_path = None for filename in remote.files_in_path(log_output_path): if "log" in filename: log_path = fs.join(log_output_path, filename) break if log_path is None: raise RuntimeError("Log does not exist remotely") # Read the text file lines = remote.read_lines(log_path) # Print the lines of the log file for line in lines: print(line) # -----------------------------------------------------------------
# Simulation is retrieved if simulation.retrieved: # Determine the path to the simulation log file local_log_file_path = simulation.log_file_path # Read the log file lines = fs.read_lines(local_log_file_path) # Not yet retrieved else: # The path to the simulation log file remote_log_file_path = simulation.remote_log_file_path # Create and setup the remote remote = Remote() remote.setup(config.remote) # Check whether the log file exists if not remote.is_file(remote_log_file_path): raise RuntimeError("The log file does not (yet) exist remotely") # Read the log file lines = remote.read_lines(remote_log_file_path) # Print the lines of the log file for line in lines: print(line) # -----------------------------------------------------------------