Skip to content
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

task sync manager preparations #835

Merged
merged 19 commits into from
Dec 10, 2024
Merged

task sync manager preparations #835

merged 19 commits into from
Dec 10, 2024

Conversation

osoukup
Copy link
Contributor

@osoukup osoukup commented Nov 21, 2024

This PR is a move towards async task management. It aims to simplify the stuff a bit and remove some more unnecessary Jira API calls. This time we focus on the calls which sync back the task right after we updated it. We will just assume that when the update is successful the Jira issue will have the values we set. We also set the task last update timestamp on our side which may be a little bit before the actual update in Jira but will be synced by the collector in a short while so no big deal. A number of test changes were necessary along the way.

I added some more parts. I reworked the decision logic regarding the task management and moved some functionality so the execution parts are at the end separated methods which can be called both synchronously and async.

Then I run into an issue that the broken way serializers update the flaws (and other and create but that was put aside) means that the save and all the parameters are not used all at once but it is called multiple times with different context - or tasksync used to be called completely separately outside of the save call. It required quite some serializer rework which is definitely not complete but already brought what I needed. I think that the result is actually simpler and more understandable then it was before but I am glad for any feedback.

@osoukup osoukup self-assigned this Nov 21, 2024
@osoukup osoukup force-pushed the task-sync-manager branch 2 times, most recently from 15a2e8d to d30cf38 Compare November 26, 2024 15:52
@osoukup osoukup added the technical For PRs that introduce changes not worthy of a CHANGELOG entry label Nov 26, 2024
@osoukup osoukup marked this pull request as ready for review November 26, 2024 15:56
@osoukup osoukup requested a review from a team November 26, 2024 15:57
@osoukup osoukup force-pushed the task-sync-manager branch 2 times, most recently from ce1ffca to 8c6bf9f Compare December 3, 2024 09:35
@osoukup
Copy link
Contributor Author

osoukup commented Dec 4, 2024

I am not getting any reviews and have to continue working so this PR is growing and growing... Sorry to the future reviewers that it will probably going to take some time but going commit-wise should help understand.

Copy link
Contributor

@JakubFrejlach JakubFrejlach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couple of things after first walkthrough but I will probably give it one more go.

osidb/serializer.py Outdated Show resolved Hide resolved
osidb/serializer.py Show resolved Hide resolved
osidb/serializer.py Outdated Show resolved Hide resolved
osidb/serializer.py Outdated Show resolved Hide resolved
as part of the complete fetch-back on sync removal and
as it is done by the following task collector run anyway
as part of the complete fetch-back on sync removal and
as to save one more unnecessary Jira API query
as most of the time no return values are needed
it used to make sense as we used to save the flaw to the DB
at the end of the save machinery but we reversed the order
so now there should always be an existing flaw or an error
while leaving the timestamp just being crafted on our side
before the actual request is being made so it is at or before
the actual Jira timestamp not preventing the task sync-back
by the collector which will eventually correct the timestamp
in case it is in a bit of desync

this may result in a second or a few seconds desync for a short
while on the task update timestamp which is however acceptable
and will save us some Jira calls syncing the task back
synchronously which happens async by the collector later anyway
as it happens after save to DB
to shift the decission responsibility from the serializer
to the model and to disallow forcing model to update when
there is no actual change which would result in an extra
Jira query without no effect as Jira ignores such queries
so they can be later called by either the synchronous
procedure or by the async sync manager
for now the creation is out of scope as I am writing this as part of
task management rework to async and I need to address the diff param
no being provided on update the way the serializers used to work

but actually this is overall very important going forward as so far
the serializers were bypassing the save method through the default
update resulting in call without parameters and then calling it
again potentially multiple times providing the parameters or
directly calling task synchronization etc. which was bad
which is already inherited from other mixin
to start performing the updates the correct way

for now I do not specifically care for affects and trackers
and other models as this is already getting out of scope of
my task but eventually we should update everything properly
this is a bit unfortunate but the PackageVersion related
serializers are so different from the rest that they do not
work with the new BaseSerializer without making it pretty
ugly which would be a step backwards and I do no want to
extend the task scope to rewriting the PackageVersion
stuff so I am basically leaving it as it was before
Copy link
Contributor

@JakubFrejlach JakubFrejlach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went through second time and didn't find anything, LGTM! A lot of good work towards simplicity!

@osoukup osoukup added this pull request to the merge queue Dec 10, 2024
Merged via the queue into master with commit 83ae2f4 Dec 10, 2024
11 checks passed
@osoukup osoukup deleted the task-sync-manager branch December 10, 2024 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
technical For PRs that introduce changes not worthy of a CHANGELOG entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants