fluxcloud.utils package¶
Submodules¶
fluxcloud.utils.fileio module¶
-
fluxcloud.utils.fileio.can_be_deleted(path, ignore_files=None)[source]¶ A path can be deleted if it contains no entries, or if the only files are in ignore_files
-
fluxcloud.utils.fileio.copyfile(source, destination, force=True)[source]¶ Copy a file from a source to its destination.
-
fluxcloud.utils.fileio.creation_date(filename)[source]¶ Get the creation date, and fallback to modified date.
-
fluxcloud.utils.fileio.get_file_hash(image_path, algorithm='sha256')[source]¶ Return an sha256 hash of the file based on a criteria level.
-
fluxcloud.utils.fileio.get_tmpdir(tmpdir=None, prefix='', create=True)[source]¶ Get a temporary directory for an operation.
-
fluxcloud.utils.fileio.get_tmpfile(tmpdir=None, prefix='fluxcloud-')[source]¶ Get a temporary file with an optional prefix.
-
fluxcloud.utils.fileio.mkdir_p(path)[source]¶ Make a directory path if it does not exist, akin to mkdir -p
-
fluxcloud.utils.fileio.read_yaml(filename)[source]¶ Load a yaml from file, roundtrip to preserve comments
-
fluxcloud.utils.fileio.recursive_find(base, pattern=None)[source]¶ Find filenames that match a particular pattern, and yield them.
-
fluxcloud.utils.fileio.remove_to_base(path, base_path)[source]¶ Delete the tree under $path and all the parents up to $base_path as long as they are empty
-
fluxcloud.utils.fileio.write_file(filename, content, mode='w', exec=False)[source]¶ Write content to a filename
fluxcloud.utils.misc module¶
fluxcloud.utils.terminal module¶
-
fluxcloud.utils.terminal.check_install(software, quiet=True, command='--version')[source]¶ check_install will attempt to run the singularity command, and return True if installed. The command line utils will not run without this check.
Parameters: - software (the software to check if installed)
- quiet (should we be quiet? (default True))
- command (the command to use to check (defaults to –version))
-
fluxcloud.utils.terminal.confirm_action(question, force=False)[source]¶ confirm if the user wants to perform a certain action
Parameters: - question (the question that will be asked)
- force (if the user wants to skip the prompt)
-
fluxcloud.utils.terminal.confirm_uninstall(filename, force=False)[source]¶ confirm if the user wants to uninstall a module
Parameters: - filename (the file that will be removed)
- force (if the user wants to skip the prompt)
-
fluxcloud.utils.terminal.get_installdir()[source]¶ get_installdir returns the installation directory of the application
-
fluxcloud.utils.terminal.run_command(cmd, sudo=False, stream=False)[source]¶ run_command uses subprocess to send a command to the terminal.
Parameters: - cmd (the command to send, should be a list for subprocess)
- error_message (the error message to give to user if fails,)
- if none specified, will alert that command failed.