resolve_remote#

brainglobe_atlasapi.remotes.resolve_remote(fs, atlas_name, remotes, is_reachable)[source]#

Find which configured remote holds an atlas.

Remotes are searched in declaration order, so the first-declared remote wins when a name exists in more than one bucket. Each remote is probed for reachability only when its turn comes, and unreachable remotes are skipped, so finding an atlas on the first remote costs two requests.

Parameters:
  • fs (s3fs.S3FileSystem) – Filesystem used to list the atlas directory.

  • atlas_name (str) – Name of the atlas to locate.

  • remotes (dict) – Mapping of remote key to remote, in resolution order.

  • is_reachable (callable) – Returns whether a remote answers.

Returns:

The winning remote, or None if no remote is reachable.

Return type:

str or None

Raises:

ValueError – If the atlas name is present in none of the reachable remotes.