fix: cast CPUTimeLeft as an int#8521
Open
aldbr wants to merge 2 commits intoDIRACGrid:integrationfrom
Open
Conversation
chrisburr
reviewed
Apr 24, 2026
| self._updateConfiguration("CPUTimeLeft", self.cpuWorkLeft) | ||
| # Store as int: consumers generally call gConfig.getValue(..., 0) | ||
| # with an int default, and a float-formatted value silently coerces to 0. | ||
| self._updateConfiguration("CPUTimeLeft", int(self.cpuWorkLeft)) |
Member
There was a problem hiding this comment.
Can you explain this a little more? I'm not seeing what this changes in practice.
Contributor
Author
There was a problem hiding this comment.
Do you want further explanations in the code comment or just an example here? Here is a very simple reproducer:
In [5]: print(gConfig.getValue("/Resources/Sites/LCG/<Site>/CEs/<CE>/Timeout", 0))
0
In [6]: print(gConfig.getValue("/Resources/Sites/LCG/<Site>/CEs/<CE>/Timeout", 0.0))
10.0
Member
There was a problem hiding this comment.
Indeed, I just mean an example here. So what happens is:
type(defaultValue)->int- we have
/Resources/.../Timeout = 10.0 int("10.0")->ValueError- catch exception silently
return defaultValue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BEGINRELEASENOTES
*WorkloadManagement
FIX: JobAgent cast CPUTimeLeft as an int
ENDRELEASENOTES
Most of the consumers are expecting an int (which makes sense actually).
Having that piece of code in the consumers:
Always results in
0, the default value.Context: #8416