This repository has been archived by the owner on Jul 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci/models.py: bring pending function to TestJob
When ProjectStatus's are computed, there's a call to Build.finished method that determines whether or not such build is done. Part of this check counts the number of testjobs with fetched=False. If the count is zero the build id finished. Due to the nature of SQUAD, testjobs are processed by multiple parallel workers and race conditions might happen. A mitigation mechanism SQUAD does have in place is to acquire a database lock in a testjob being fetched while it attempts to fetch it from its backend. Once results are retrieved SQUAD marks the testjob with fetched=True and continue processing it. The processing includes result parsing and plugins. Some testjobs can get pretty slow depending on volume of results. There is a problem with this approach though. If a build has 2 jobs, and one of them finishes faster than the other (fetching + processing), while the slow one is already marked as fetched but not yet done with its results, it will appear that the build is already finished. With this patch, I change TestJob.job_status to 'Fetching' while still on database lock and only remove it after plugin processing takes place. Finally I move the pending check of testjobs from Build.finished method to within TestJobManager class and add an extra condition which checks if a job is marked as fetched but still have job_status=Fetching. This should guarantee that when builds are marked as finished, all testjobs results will actually be processed within SQUAD. Signed-off-by: Charles Oliveira <[email protected]>
- Loading branch information
Showing
3 changed files
with
111 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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