From 2e9d4adce59593e2ff365afa0b249eb7be76513e Mon Sep 17 00:00:00 2001 From: Leonardo Schwarz Date: Mon, 16 Dec 2024 11:01:52 +0100 Subject: [PATCH 1/4] Always set workunits to processing --- docs/changelog.md | 4 ++++ src/bfabric/wrapper_creator/bfabric_submitter.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/docs/changelog.md b/docs/changelog.md index 42caa68..ea1834f 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -10,6 +10,10 @@ Versioning currently follows `X.Y.Z` where ## \[Unreleased\] +### Changed + +- The submitter ensures that workunits always get set to `processing`. + ## \[1.13.11\] - 2024-12-13 ### Fixed diff --git a/src/bfabric/wrapper_creator/bfabric_submitter.py b/src/bfabric/wrapper_creator/bfabric_submitter.py index 0e258b1..7bffd81 100644 --- a/src/bfabric/wrapper_creator/bfabric_submitter.py +++ b/src/bfabric/wrapper_creator/bfabric_submitter.py @@ -146,6 +146,9 @@ def compose_bash_script(self, configuration=None, configuration_parser=lambda x: fi # exit 0 +# Set the workunit status to processing +bfabric_setWorkunitStatus_processing.py $WORKUNIT_ID + # run the application test -f $TEMPDIR/config_WU$WORKUNIT_ID.yaml && {executable} $TEMPDIR/config_WU$WORKUNIT_ID.yaml @@ -163,6 +166,7 @@ def compose_bash_script(self, configuration=None, configuration_parser=lambda x: echo "application failed" mutt -s "WORKUNIT_ID=$WORKUNIT_ID EXTERNALJOB_ID=$EXTERNALJOB_ID failed" $EMAIL < /dev/null bfabric_setResourceStatus_available.py $RESSOURCEID_STDOUT_STDERR $RESSOURCEID; + bfabric_setWorkunitStatus_failed.py $WORKUNIT_ID exit 1; fi From ac4eb3f5e77c522534f15a3925a6071236812bf7 Mon Sep 17 00:00:00 2001 From: Leonardo Schwarz Date: Mon, 16 Dec 2024 14:23:21 +0100 Subject: [PATCH 2/4] log the file path being tested --- src/bfabric_scripts/feeder/report.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/bfabric_scripts/feeder/report.py b/src/bfabric_scripts/feeder/report.py index 1e5219d..f0be455 100644 --- a/src/bfabric_scripts/feeder/report.py +++ b/src/bfabric_scripts/feeder/report.py @@ -20,6 +20,7 @@ def report_resource(client: Bfabric, resource_id: int) -> ResultContainer: return ResultContainer([]) filename = Path(resource.storage["basepath"]) / resource["relativepath"] + logger.info("Testing file: {}", filename) if filename.is_file(): checksum, _, filesize, _ = get_file_attributes(str(filename)) return client.save( From c071bd28e2d1f9007af8bcc1e244416b9e605fe8 Mon Sep 17 00:00:00 2001 From: Leonardo Schwarz Date: Mon, 16 Dec 2024 14:38:29 +0100 Subject: [PATCH 3/4] The script `bfabric_setResourceStatus_available.py` and other uses of `report_resource`, correctly search files which have a relative path starting with `/` as in the case of the legacy wrapper creator. --- docs/changelog.md | 5 +++++ src/bfabric_scripts/feeder/report.py | 11 ++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/docs/changelog.md b/docs/changelog.md index ea1834f..19b36bc 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -14,6 +14,11 @@ Versioning currently follows `X.Y.Z` where - The submitter ensures that workunits always get set to `processing`. +### Fixed + +- The script `bfabric_setResourceStatus_available.py` and other uses of `report_resource`, correctly search files which + have a relative path starting with `/` as in the case of the legacy wrapper creator. + ## \[1.13.11\] - 2024-12-13 ### Fixed diff --git a/src/bfabric_scripts/feeder/report.py b/src/bfabric_scripts/feeder/report.py index f0be455..e1d2c3f 100644 --- a/src/bfabric_scripts/feeder/report.py +++ b/src/bfabric_scripts/feeder/report.py @@ -9,6 +9,14 @@ from bfabric_scripts.feeder.file_attributes import get_file_attributes +def _make_relative(path: str) -> str: + # TODO this is a hack which is necessary due to behavior of the legacy wrapper_creator, hopefully no + # other code uses leading slashes to indicate relative paths but this will be seen later when refactoring this + # away. + # replaces any number of leading slashes with an empty string + return path.lstrip("/") + + def report_resource(client: Bfabric, resource_id: int) -> ResultContainer: """Saves the provided resource's checksum, file size and available state.""" resource = Resource.find(id=resource_id, client=client) @@ -19,7 +27,8 @@ def report_resource(client: Bfabric, resource_id: int) -> ResultContainer: logger.error("Resource does not have a storage") return ResultContainer([]) - filename = Path(resource.storage["basepath"]) / resource["relativepath"] + relative_path = _make_relative(resource["relativepath"]) + filename = Path(resource.storage["basepath"]) / relative_path logger.info("Testing file: {}", filename) if filename.is_file(): checksum, _, filesize, _ = get_file_attributes(str(filename)) From b1a195931d8783ebcef6a2564eeb845cb0895005 Mon Sep 17 00:00:00 2001 From: Leonardo Schwarz Date: Tue, 17 Dec 2024 10:43:00 +0100 Subject: [PATCH 4/4] 1.13.12 --- docs/changelog.md | 2 ++ pyproject.toml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/changelog.md b/docs/changelog.md index 19b36bc..4659d86 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -10,6 +10,8 @@ Versioning currently follows `X.Y.Z` where ## \[Unreleased\] +## \[1.13.12\] - 2024-12-17 + ### Changed - The submitter ensures that workunits always get set to `processing`. diff --git a/pyproject.toml b/pyproject.toml index 3eb8cc6..de22e28 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "bfabric" description = "Python client for the B-Fabric WSDL API" -version = "1.13.11" +version = "1.13.12" license = { text = "GPL-3.0" } authors = [ { name = "Christian Panse", email = "cp@fgcz.ethz.ch" },