Skip to content

Commit

Permalink
Merge pull request #281 from aodn/copy-to-landing
Browse files Browse the repository at this point in the history
Fix copy to landing logic
  • Loading branch information
mhidas authored Feb 6, 2025
2 parents bc3d936 + 03a95ff commit 8787077
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions aodncore/pipeline/watch.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,10 +200,7 @@ def run(self, incoming_file):
self.logger.sysinfo(
"{self.__class__.__name__}.error_exit_policies -> "
"{policies}".format(self=self, policies=[p.name for p in error_exit_policies]))

self.logger.sysinfo(
f"{self.__class__.__name__}.kwargs -> {kwargs}"
)
self.logger.debug(f"{self.__class__.__name__}.kwargs -> {kwargs}")

file_state_manager = IncomingFileStateManager(input_file=incoming_file,
pipeline_name=pipeline_name,
Expand Down Expand Up @@ -504,15 +501,16 @@ def _copy_to_landing(self):
return

self.logger.info(
f"{self.__class__.__name__}.copy_to_landing -> 's3://{self.landing_bucket}/{self.landing_prefix}'")
self.logger.sysinfo(f"Uploading {self.input_file} to 's3://{self.landing_bucket}/{self.landing_prefix}'")
f"{self.__class__.__name__}.copy_to_landing -> 's3://{self.landing_bucket}/{self.landing_prefix}'"
)
try:
upload_to_s3(self.input_file, self.landing_bucket, self.landing_prefix, self.basename)
except Exception as e:
self.logger.warning(f"Failed to upload file to s3://{self.landing_bucket}/{self.landing_prefix}: {e}")
self.logger.warning(f"Failed to upload to s3://{self.landing_bucket}/{self.landing_prefix}: {e}")
self.copy_to_landing_successful = False

self.copy_to_landing_successful = True
else:
self.logger.info(f"Incoming file uploaded to 's3://{self.landing_bucket}/{self.landing_prefix}/{self}'")
self.copy_to_landing_successful = True


def _move_to_processing(self):
Expand Down

0 comments on commit 8787077

Please sign in to comment.