Skip to content

Commit

Permalink
Merge pull request #117 from fgcz/main
Browse files Browse the repository at this point in the history
1.13.12
  • Loading branch information
leoschwarz authored Dec 17, 2024
2 parents c658c84 + b1a1959 commit caed4ed
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 2 deletions.
11 changes: 11 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,17 @@ 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`.

### 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
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "[email protected]" },
Expand Down
4 changes: 4 additions & 0 deletions src/bfabric/wrapper_creator/bfabric_submitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
12 changes: 11 additions & 1 deletion src/bfabric_scripts/feeder/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -19,7 +27,9 @@ 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))
return client.save(
Expand Down

0 comments on commit caed4ed

Please sign in to comment.