log.warning("The '" + name + "' preparation directory is empty, skipping ...") continue initialized_path = fs.join(prep_path, "initialized.fits") if not fs.is_file(initialized_path): # Check whether cached image is present remote_prep_path = cached_directory_path_for_single_command( environment, "prepare_data", remote) #print(remote_prep_path) remote_image_directory_path = fs.join(remote_prep_path, name) #print(remote_image_directory_path) remote_initialized_path = fs.join(remote_image_directory_path, "initialized.fits") if not remote.is_directory( remote_prep_path) or not remote.is_directory( remote_image_directory_path) or not remote.is_file( remote_initialized_path): log.warning("The initialized '" + name + "' image is not found, skipping ...") continue # Cache # Create directory for the image # Get the path path = paths[name] # Get filename filename = fs.strip_extension(fs.name(path)) #print(filename)
config = parse_arguments("open", definition, description="Open a file on a remote host") # ----------------------------------------------------------------- # Connect to remote remote = Remote() remote.setup(config.remote) # Determine the absolute file path filepath = remote.absolute_path(config.filename) # Determine the file path relative to the home directory relative_filepath = remote.relative_to_home(filepath) # Check if the file exists; otherwise don't bother mounting if not remote.is_file(filepath): log.error("The file does not exist") exit() # Disconnect the remote remote.logout() # ----------------------------------------------------------------- # Create the mounter mounter = RemoteMounter() # Mount and get the mount path mount_path = mounter.mount(config.remote) # Determine the local file path
# 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) # -----------------------------------------------------------------
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) # -----------------------------------------------------------------