-
Notifications
You must be signed in to change notification settings - Fork 115
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
Fix scheduled task purge failing without user #5896
Conversation
CHANGES/5881.bugfix
Outdated
@@ -0,0 +1 @@ | |||
Fixed task purge to not expect a user when run scheduled. |
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.
s/run scheduled/run is scheduled
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.
Is that the difference between adjective and adverb?
Anyway both of us not being native english speakers, we should try to use more simple language. What about:
"... when running from a schedule."?
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.
"scheduled run" is an adjective. "run is scheduled" is a verb formation. "run scheduled" is...an adverb, because it's being used to describe how a ting was/is run? But it's an awkward construct, to my native-speaking ear. This is, of course, English, where awkward constructs are understandable.
Perhaps "...to not expect a user, when a run has been scheduled by Pulp itself." Wordy, but makes everything explicit?
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.
Explicit enough for everybody is what i want to aim for.
After talking to @ggainey i think there might be a better solution than the weird. Heuristic applied here. Marking as draft again. |
faa24ef
to
a51effb
Compare
When a task was dispatched by a task schedule, there is no user attached to it. Such purge tasks should just look at all tasks. fixes pulp#5881
a51effb
to
cad1a72
Compare
current_user = get_current_authenticated_user() | ||
assert current_user is not None, ( | ||
"This task should have been dispatched by a user. Cannot find it though. " | ||
"Maybe it got deleted." |
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.
👍
@@ -0,0 +1 @@ | |||
Fixed task purge to not expect a user, when a run has been scheduled by Pulp itself. |
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.
👍
Backport to 3.65: 💚 backport PR created✅ Backport PR branch: Backported as #5899 🤖 @patchback |
When a task was dispatched by a task schedule, there is no user attached to it. So purge tasks should just look at all tasks. However when a user gets deleted after dispatching that task, the task will run with current_user=None also. We need to make sure not to purge too many tasks in this case.
fixes #5881