mento.utils#

Utility functions for internal use by online analysis triggering modules at different beamlines.

Functions#

_map_local_to_remote_path(beamline_local_path, remote_rootdir, remote_subdir):

Generate file path on the remote cluster corresponding to a local file path as shown at the beamline.

_name_resultfile_with_suffix(datafile_path, result_suffix):

Generate result file name on local beamline filesystem, derived from input data file.

_name_resultdir(datafile_path):

Get the full path of the location to store results corresponding to the input data file.

make_writable_dir(dir_name):

Create a directory and make it world-writable, world-readable.

run_subprocess():

Run command either on local machine with Bash, or after connecting to remote machine with SSH

run_slurm():

Not yet implemented

retrieve_script_path(arg_list):

Get the path to the local/remote script to be run by the trigger

retrieve_arg_list(arg_list):

Get the arguments to be fed to the local/remote script to be run by the trigger

flatten_arg_list(arg_list):

Flatten all nested lists inside a list to present a one-level list (with no list element being a list itself)

Functions

flatten_arg_list(arg_list)

Internal function.

get_path_core(local_path, remote_dir[, split_at])

Get the full path valid on the core filesystem on Maxwell, corresponding to the local path.

get_path_mountpoint(local_path, remote_dir)

Get the full path valid on the reserved compute node during the beamtime.

make_writable_dir(dir_name)

Create a directory and make it world-writable, world-readable.

prepare_results_filename(data_file_path[, ...])

Make up the name of a result file, derived from the input data file name, then create the appropriate directory tree to store this result file in.

run_slurm()

Use Slurm REST API to submit a batch job directly from the local machine.

run_subprocess(arg_list)

Use Python's subprocess module to run a command with arguments.