baskerville.helpers package
Submodules
baskerville.helpers.gcs_utils module
- baskerville.helpers.gcs_utils.download_folder_from_gcs(gcs_dir: str, local_dir: str, bytes=True) None [source]
Downloads a whole folder from GCS :param gcs_dir: string path to GCS folder to download :param local_dir: string path to download to :param bytes: boolean flag indicating if gcs file contains bytes
Returns: None
- baskerville.helpers.gcs_utils.download_from_gcs(gcs_path: str, local_path: str, bytes=True) None [source]
Downloads a file from GCS :param gcs_path: string path to GCS file to download :param local_path: string path to download to :param bytes: boolean flag indicating if gcs file contains bytes
Returns: None
- baskerville.helpers.gcs_utils.download_rename_inputs(filepath: str, temp_dir: str, is_dir: bool = False) str [source]
Download file from gcs to local dir :param filepath: GCS Uri follows the format gs://$BUCKET_NAME/OBJECT_NAME :param temp_dir: local dir to download to :param is_dir: boolean flag indicating if the filepath is a directory
Returns: new filepath in the local machine
- baskerville.helpers.gcs_utils.gcs_file_exist(gcs_path: str) bool [source]
check if a file exist in gcs params: gcs_path returns: true/false
- baskerville.helpers.gcs_utils.get_filename_in_dir(files_dir: str, recursive: bool = False) List[str] [source]
Returns list of filenames inside a directory.
- baskerville.helpers.gcs_utils.is_gcs_path(gcs_path: str) bool [source]
Returns True if the string passed starts with gs:// :param gcs_path: string path to check
Returns: Boolean flag indicating the gcs_path starts with gs://
- baskerville.helpers.gcs_utils.split_gcs_uri(gcs_uri: str) tuple [source]
Splits a GCS bucket and object_name from a GCS URI :param gcs_uri: string GCS Uri follows the format gs://$BUCKET_NAME/OBJECT_NAME
Returns: bucket_name, object_name
- baskerville.helpers.gcs_utils.sync_dir_to_gcs(local_dir: str, gcs_dir: str, verbose=False, recursive=False) None [source]
Copies all files in a local directory to the gcs directory :param local_dir: string local directory path to upload from :param gcs_dir: string GCS destination path. Will create folders that do not exist. :param verbose: boolean flag to print logging statements :param recursive: boolean flag to recursively upload files in subdirectories
Returns: None
- baskerville.helpers.gcs_utils.upload_file_gcs(local_path: str, gcs_path: str, bytes=True) None [source]
Upload a file to gcs :param local_path: local path to file :param gcs_path: string GCS Uri follows the format gs://$BUCKET_NAME/OBJECT_NAME
Returns: None
- baskerville.helpers.gcs_utils.upload_folder_gcs(local_dir: str, gcs_dir: str) None [source]
Copies all files in a local directory to the gcs directory :param local_dir: string local directory path to upload from :param gcs_dir: string GCS destination path. Will create folders that do not exist.
Returns: None
baskerville.helpers.h5_baskerville_utils module
baskerville.helpers.h5_utils module
baskerville.helpers.tensorrt_helpers module
baskerville.helpers.trt_optimized_model module
baskerville.helpers.utils module
- baskerville.helpers.utils.exec_par(cmds, max_proc=None, verbose=False)[source]
Execute the commands in the list ‘cmds’ in parallel, but only running ‘max_proc’ at a time. :param cmds: list of commands to execute :param max_proc: maximum number of processes to run in parallel :param verbose: print command to stderr