Skip to content

Commit

Permalink
Raise error for all non-0 returncodes of gbas2_job_status.py
Browse files Browse the repository at this point in the history
Previously we only raised an exception for returncodes of 3 and otherwise
accepted the output. Any other returncodes should in theory not be possible but
better be defensive and fail early with a proper error message instead of
accepting garbage output and failing later with a confusing error message.
  • Loading branch information
meliache committed Nov 3, 2023
1 parent 7483e1e commit 4418938
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
### Added

* **gbasf2:** New setting `gbasf2_setup_path` which can be used to customize the path to the gbasf2 setup file directly (default: `"/cvmfs/belle.kek.jp/grid/gbasf2/pro/tools/setup.sh"`). It is a more flexible replacement for the `gbasf2_install_directory` setting, which will be removed in the future, since we can't predict potential name and path changes of the setup script between gbasf2 releases. @meliache [#162](https://github.com/nils-braun/b2luigi/pull/162)
* **gbasf2:** Raise error for all non-zero return codes of ``gbas2_job_status.py``. This should result in better and earlier error messages if getting the job statuses in a gbasf2 project fails due to unexpected reasons.


### Fixed

Expand Down
4 changes: 4 additions & 0 deletions b2luigi/batch/processes/gbasf2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,10 @@ def get_gbasf2_project_job_status_dict(
f"\nCould not find any jobs for project {gbasf2_project_name} on the grid.\n"
+ "Probably there was an error during the project submission when running the gbasf2 command.\n"
)
if proc.returncode > 0:
raise subprocess.CalledProcessError(
proc.returncode, job_status_command, output=proc.stdout, stderr=proc.stderr
)
job_status_json_string = proc.stdout
return json.loads(job_status_json_string)

Expand Down

0 comments on commit 4418938

Please sign in to comment.