-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[8.1] Add VO in Jobs table #7215
[8.1] Add VO in Jobs table #7215
Conversation
4acfe35
to
d3079b3
Compare
@@ -42,6 +42,7 @@ CREATE TABLE `Jobs` ( | |||
`JobName` VARCHAR(128) NOT NULL DEFAULT 'Unknown', | |||
`Owner` VARCHAR(64) NOT NULL DEFAULT 'Unknown', | |||
`OwnerGroup` VARCHAR(128) NOT NULL DEFAULT 'Unknown', | |||
`VO` VARCHAR(32), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not:
`VO` VARCHAR(32), | |
`VO` VARCHAR(32) NOT NULL DEFAULT 'Unknown', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By not having a default value, a query trying to insert a row without the VO field will raise an IntegrityError
in sqlalchemy, which will quickly indicate to the developer that something is wrong. Besides, now that the VO is used to get information from the config and that this field can no longer be determined by the OwnerGroup
, having values as "Unknown" could be problematic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a query trying to insert a row without the VO field will raise an IntegrityError in sqlalchemy
Would it raise an IntegrityError
if the column has no NOT NULL
constraint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you're right. I'll correct it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the end I ended up adding the DEFAULT 'Unknown' because the _update method in DIRAC actually translates to an UPSERT, which causes an error because of the insert statement:
2023-09-27T08:34:51,221683Z Framework/WorkloadManagement/JobDB DEBUG: _update: INSERT INTO Jobs (JobID, Status) VALUES (3, "Received") ON DUPLICATE KEY UPDATE Status=VALUES(Status)
2023-09-27T08:34:51,221956Z Framework/WorkloadManagement/JobDB ERROR: _update (INSERT INTO Jobs (JobID, Status) VALUES (3, "Received") ON DUPLICATE KEY UPDATE Status=VALUES(Status)): Execution failed. 1364: Field 'VO' doesn't have a default value
ae972ad
to
b1c6906
Compare
b1c6906
to
dde7b2b
Compare
@aldbr Would you mind also checking the changes I made to the wiki page ? (I don't know if you did it already) |
See discussion #7197 for further information.
This will require DB changes.
BEGINRELEASENOTES
*WMS
CHANGE: add VO info in the table Jobs of JobDB
ENDRELEASENOTES