MinioAdaptor#

class servicex.minio_adaptor.MinioAdaptor(minio_endpoint: str, secured: bool = False, access_key: str = 'miniouser', secretkey: str = 'leftfoot1')[source]#

Bases: object

__init__(minio_endpoint: str, secured: bool = False, access_key: str = 'miniouser', secretkey: str = 'leftfoot1')[source]#

Methods

_download_executor()#
async download_file(request_id: str, bucket_fname: str, output_file: Path) None[source]#

Download a single file to a local temp file.

Arguments:

minio_client Open and authenticated minio client request_id The id of the request we are going after bucket_fname The fname of the bucket output_file Filename where we should write this file.

Notes:
  • Download to a temp file that is renamed at the end so that a partially downloaded file is not mistaken as a full one

  • Run with async, despite minio not being async.

get_access_url(request_id: str, object_name: str) str[source]#

Given a request ID and the file name in that request id, return a URL that can be directly accessed to download the file.

Args:

request_id (str): The request id guid (that is the bucket in minio) object_name (str): The file (the object in the minio bucket)

Returns:

str: A url good for some amount of time to access the bucket.

get_files(request_id) List[str][source]#
get_s3_uri(request_id: str, object_name: str) str[source]#

Given a request ID and a file name in that request, return an S3 URI that can be used by a correctly configured S3 client.

Args: :param request_id: The request id guid (that is the bucket in minio) :param object_name: The file (the object in the minio bucket) :return:

A formatted S3 URI to that object