diff --git a/setup.py b/setup.py index 3dcec4d..74a61f2 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ # This call to setup() does all the work setuptools.setup( name="cupyopt", - version="0.15.13.1", + version="0.15.13.2", description="CU Python Opinionated Prefect Tasks", long_description=README, long_description_content_type="text/x-rst", diff --git a/src/cupyopt/objectstore_tasks.py b/src/cupyopt/objectstore_tasks.py index 993e67b..0807d06 100644 --- a/src/cupyopt/objectstore_tasks.py +++ b/src/cupyopt/objectstore_tasks.py @@ -1,6 +1,5 @@ """ object store functions """ -import logging import os from typing import Any from typing_extensions import Literal @@ -33,7 +32,7 @@ def run( self, config_box: Box, http_client: urllib3.poolmanager.PoolManager = None ) -> Minio: - logging.info( + self.logger.info( "Creating object store client for endpoint %s.", config_box.endpoint ) client = Minio( @@ -62,9 +61,11 @@ def run(self, client: Minio, bucket_name: str): # make bucket if not exists if not client.bucket_exists(bucket_name): client.make_bucket(bucket_name) - logging.info("Created bucket %s", bucket_name) + self.logger.info("Created bucket %s", bucket_name) else: - logging.info("Bucket %s already exists, taking no actions.", bucket_name) + self.logger.info( + "Bucket %s already exists, taking no actions.", bucket_name + ) class ObjstrPut(Task): @@ -117,7 +118,7 @@ def run( part_size=part_size, ) - logging.info("Put data under %s as %s", bucket_name, object_name) + self.logger.info("Put data under %s as %s", bucket_name, object_name) class ObjstrGet(Task): @@ -149,7 +150,7 @@ def run(self, client: Minio, bucket_name: str, object_name: str) -> Any: object_name=object_name, ) - logging.info( + self.logger.info( "Retrieved object %s under %s", object_name, bucket_name, @@ -191,7 +192,7 @@ def run( object_name=object_name, ) - logging.info( + self.logger.info( "Retrieved object %s under %s", object_name, bucket_name, @@ -244,7 +245,9 @@ def run( file_path=file_path, ) - logging.info("Put file %s under %s as %s", file_path, bucket_name, object_name) + self.logger.info( + "Put file %s under %s as %s", file_path, bucket_name, object_name + ) class ObjstrFGet(Task): @@ -277,7 +280,7 @@ def run( file_path=file_path, ) - logging.info( + self.logger.info( "Retrieved object %s under %s as file %s", object_name, bucket_name, diff --git a/src/cupyopt/sftp_tasks.py b/src/cupyopt/sftp_tasks.py index ea7da54..47d5046 100644 --- a/src/cupyopt/sftp_tasks.py +++ b/src/cupyopt/sftp_tasks.py @@ -100,7 +100,7 @@ def run( tempfolderpath = data.parameters["cache"] localtmpfile = os.path.join(tempfolderpath, workfile) - self.logger.debug("Working on {}", os.path.join(tempfolderpath, workfile)) + self.logger.debug("Working on %s", os.path.join(tempfolderpath, workfile)) if config_box.get("private_key_path"): private_key = config_box["private_key_path"] @@ -136,7 +136,7 @@ def run( finally: sftp.close() - self.logger.info("SFTPGet {}", localtmpfile) + self.logger.info("SFTPGet %s", localtmpfile) return localtmpfile @@ -202,7 +202,7 @@ def run( finally: sftp.close() - self.logger.info("SFTPPut {}", workfile) + self.logger.info("SFTPPut %s", workfile) class SFTPRemove(Task): @@ -222,7 +222,7 @@ def run( ): with prefect.context(**format_kwargs) as data: - self.logger.debug("Attempting to remove ", workfile) + self.logger.debug("Attempting to remove %s", workfile) if data.get("parameters"): if data.parameters.get("cnopts"): @@ -264,7 +264,7 @@ def run( sftp.close() # Read the file into a dataframe - self.logger.info("SFTPRemove {}", workfile) + self.logger.info("SFTPRemove %s", workfile) class SFTPRename(Task): @@ -330,7 +330,7 @@ def run( filename = os.path.basename(remotesourcepath) self.logger.debug( - "Moving {} from {} to {}", filename, remotesourcepath, remotetargetpath + "Moving %s from %s to %s", filename, remotesourcepath, remotetargetpath ) # Move the file from source to target on the SFTP @@ -341,7 +341,7 @@ def run( # Working in notebooks you might have already # moved the file in another block self.logger.warning( - "The file {} isn't in the remote folder.", + "The file %s isn't in the remote folder.", os.path.join(remotesourcepath, filename), ) else: @@ -429,7 +429,7 @@ def run( files_df = pd.DataFrame(files_data, columns=["File Name", "MTime"]) - self.logger.info("Found {} files to process.", len(files_df.index)) + self.logger.info("Found %s files to process.", len(files_df.index)) return files_df @@ -467,5 +467,5 @@ def run(self, files_df: pd.DataFrame, regex_search: str) -> str: # Fetch the oldest file from the frame and bring it to a local temp file. workfile = files_df.iloc[0]["File Name"] - self.logger.info("Found oldest file, {}", workfile) + self.logger.info("Found oldest file, %s", workfile) return workfile