available_path¶
-
hep_rfm.
available_path
(paths, modifiers=None, allow_protocols=None)[source]¶ Return the first available path from a list of paths. If a local path results after applying “modifiers” to any of the given paths, then this is returned (as a local path). If any of the paths in “paths” is remote, then “allow_protocols” permits the user to make this function return a path if it belongs to one of the given protocols, that must be specified as a container of strings. The first matching path will be returned.
Parameters: - paths (collection(ProtocolPath)) – list of paths to process.
- modifiers (dict) – modifiers to be applied in the set of paths.
- allow_protocols (container(str)) – possible protocols to consider.
Returns: first available path found.
Return type: Raises: RuntimeError – if it fails to find an available path.
See also
Warning
If the path to a file on a remote site matches that of a local file, it will be returned. This allows to use local files while specifying remote paths. However, if a path on a remote site matches a local file, which does not correspond to a proxy of the path referenced by this object, it will result on a fake reference to the file.