modos.remote#

Functions related to server storage handling

Classes#

EndpointManager

Handle modos server endpoints.

Functions#

list_remote_items(url)

get_metadata_from_remote(url[, modo_id])

Function to access metadata from one specific or all modos on a remote server

is_s3_path(path)

Check if a path is an S3 path

get_s3_path(url, query[, exact_match])

Request public S3 path of a specific modo or all modos matching the query string

Module Contents#

class modos.remote.EndpointManager[source]#

Handle modos server endpoints. If a modos server url is provided, it is used to detect available service urls. Alternatively, service urls can be provided explicitely if no modos server is available.

Parameters:
  • modos – URL to the modos server.

  • services – Mapping of services to their urls.

Examples

>>> ex = EndpointManager(modos="http://modos.example.org") 
>>> ex.list() 
{
  's3: Url('http://s3.example.org/'),
  'htsget': Url('http://htsget.example.org/')
}
>>> ex.htsget 
Url('http://htsget.example.org/')
>>> ex = EndpointManager(services={"s3": "http://s3.example.org"})
>>> ex.s3
Url('http://s3.example.org/')
modos: pydantic.HttpUrl | None = None[source]#
services: dict[str, pydantic.HttpUrl][source]#
list()[source]#

List available endpoints.

Return type:

dict[str, pydantic.HttpUrl]

property s3: pydantic.HttpUrl | None[source]#
Return type:

Optional[pydantic.HttpUrl]

property htsget: pydantic.HttpUrl | None[source]#
Return type:

Optional[pydantic.HttpUrl]

modos.remote.list_remote_items(url)[source]#
Parameters:

url (pydantic.HttpUrl)

Return type:

list[pydantic.HttpUrl]

modos.remote.get_metadata_from_remote(url, modo_id=None)[source]#

Function to access metadata from one specific or all modos on a remote server

Parameters:
  • server_url – Url to the remote modo server

  • id – id of the modo to retrieve metadata from. Will return all if not specified (default).

  • url (pydantic.HttpUrl)

  • modo_id (Optional[str])

Return type:

Mapping

modos.remote.is_s3_path(path)[source]#

Check if a path is an S3 path

Parameters:

path (str)

modos.remote.get_s3_path(url, query, exact_match=False)[source]#

Request public S3 path of a specific modo or all modos matching the query string :param remote_url: Url to the remote modo server :param query: query string to specify the modo of interest :param exact_match: if True only modos with exactly that id will be returned, otherwise (default) all matching modos

Parameters:
  • url (pydantic.HttpUrl)

  • query (str)

  • exact_match (bool)

Return type:

list