Skip to content

Commit

Permalink
Update versioning format and fix file transfers (#47)
Browse files Browse the repository at this point in the history
* Update versioning format and fix file transfers

* Set changelog version

* Fix versioning

* Correct version number

* bump version v24.4.0 -> v24.5.0
  • Loading branch information
adammcdonagh authored Jan 30, 2024
1 parent c65bcf4 commit 820c090
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 13 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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="[email protected]" },
]
Expand Down Expand Up @@ -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
Expand Down
29 changes: 19 additions & 10 deletions src/opentaskpy/taskhandlers/transfer.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Task handler for running transfers."""

import random
import shutil
import threading
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand All @@ -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(
Expand Down

0 comments on commit 820c090

Please sign in to comment.