From 820c0907fc637a6a21248634766cae50a9175af5 Mon Sep 17 00:00:00 2001 From: Adam McDonagh <27215476+adammcdonagh@users.noreply.github.com> Date: Tue, 30 Jan 2024 00:04:00 +0000 Subject: [PATCH] Update versioning format and fix file transfers (#47) * Update versioning format and fix file transfers * Set changelog version * Fix versioning * Correct version number * bump version v24.4.0 -> v24.5.0 --- CHANGELOG.md | 5 +++++ pyproject.toml | 6 ++--- src/opentaskpy/taskhandlers/transfer.py | 29 ++++++++++++++++--------- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 146a502..b6637fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +# v24.5.0 + +- Change versioning format +- Fixed file transfers to ensure that only files matching the regex are actually transferred + # v0.15.2 - Fix issue loading modules too fast with multiple steps in a batch diff --git a/pyproject.toml b/pyproject.toml index cbf9d35..3b56f89 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "opentaskpy" -version = "0.15.2" +version = "v24.5.0" authors = [ { name="Adam McDonagh", email="adam@elitemonkey.net" }, ] @@ -58,8 +58,8 @@ task-run = "opentaskpy.cli.task_run:main" profile = 'black' [tool.bumpver] -current_version = "0.15.2" -version_pattern = "MAJOR.MINOR.PATCH" +current_version = "v24.5.0" +version_pattern = "vYY.WW.PATCH[-TAG]" commit_message = "bump version {old_version} -> {new_version}" commit = true tag = true diff --git a/src/opentaskpy/taskhandlers/transfer.py b/src/opentaskpy/taskhandlers/transfer.py index 63ec417..23b9711 100644 --- a/src/opentaskpy/taskhandlers/transfer.py +++ b/src/opentaskpy/taskhandlers/transfer.py @@ -1,4 +1,5 @@ """Task handler for running transfers.""" + import random import shutil import threading @@ -324,7 +325,19 @@ def run(self, kill_event: threading.Event | None = None) -> bool: # noqa: C901 ) # Determine what needs to be transferred - remote_files = self.source_remote_handler.list_files() + source_directory = ( + self.source_file_spec["directory"] + if "directory" in self.source_file_spec + else None + ) + source_file_pattern = ( + self.source_file_spec["fileRegex"] + if "fileRegex" in self.source_file_spec + else None + ) + remote_files = self.source_remote_handler.list_files( + directory=source_directory, file_pattern=source_file_pattern + ) # Loop through the returned files to see if they match the file age and size spec (if defined) if "conditionals" in self.source_file_spec and remote_files: @@ -380,11 +393,9 @@ def run(self, kill_event: threading.Event | None = None) -> bool: # noqa: C901 self.logger.log( 12, - ( - "Checking file age - Last modified time:" - f" {time.ctime(file_modified_time)} - Age in secs:" - f" {file_age} secs" - ), + "Checking file age - Last modified time:" + f" {time.ctime(file_modified_time)} - Age in secs:" + f" {file_age} secs", ) if min_age and file_age <= min_age: @@ -408,10 +419,8 @@ def run(self, kill_event: threading.Event | None = None) -> bool: # noqa: C901 if "error" in self.source_file_spec and not self.source_file_spec["error"]: return self.return_result( 0, - ( - "No remote files could be found to transfer. But not erroring" - " due to config" - ), + "No remote files could be found to transfer. But not erroring" + " due to config", ) return self.return_result(