Skip to content

Commit

Permalink
fix(agent): detect absence in slurmrestd warnings
Browse files Browse the repository at this point in the history
Detect absence of warnings key in slurmrestd reponses and emit warning
log instead of crashing.

fix #316
  • Loading branch information
rezib committed Aug 30, 2024
1 parent c79cc78 commit 3e7c525
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
interpreted by frontend and emit clear error message in logs (#321).
- Detect responses from slurmrestd not formatted in JSON, translated into JSON
error for frontend and emit clear error message in logs (#333).
- Detect absence of _warnings_ key in `slurmrestd` responses and emit warning
log instead of crashing (#316).
- genjwt: fix portability to Python < 3.8 in debug message.
- ldap-check: fix usage of `user_name_attribute` configuration parameter (#340).
- frontend:
Expand Down
8 changes: 7 additions & 1 deletion slurmweb/views/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,13 @@ def slurmrest(query, key, handle_errors=True):
error["description"],
error["source"],
)
if len(result["warnings"]):
if "warnings" not in result:
logger.error(
"Unable to extract warnings from slurmrestd response to %s, unsupported "
"Slurm version?",
query,
)
elif len(result["warnings"]):
logger.warning("slurmrestd query %s warnings: %s", query, result["warnings"])
return result[key]

Expand Down

0 comments on commit 3e7c525

Please sign in to comment.