Conversation
3f46e81 to
cc9e821
Compare
Codecov ReportBase: 96.35% // Head: 95.14% // Decreases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #18 +/- ##
==========================================
- Coverage 96.35% 95.14% -1.21%
==========================================
Files 26 21 -5
Lines 3097 2596 -501
Branches 362 311 -51
==========================================
- Hits 2984 2470 -514
- Misses 81 88 +7
- Partials 32 38 +6
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
|
Ok, I've added a priority field to MurdockJob. We can discuss whether fasttracking is needed at all, but maybe it's nice to have it as "build that next" hammer. @aabadie how does the added JobModel field interact with the existing database? |
|
As for how to set priorities, I'd suggest (as discussed before with @aabadie) configuration in .murdock.yml: |
|
adding the priority configuration was straight-forward. |
| else False | ||
| ) # type: ignore[union-attr] | ||
| self.priority: int = MurdockJob.calculate_priority( | ||
| config, pr, ref, self.fasttracked |
There was a problem hiding this comment.
all these function parameters are already instance attributes. Thus there's no need for calculate_priority to be a staticmethod. A regular instance method, private, should be enough def _priority(self): and use self.config, self.pr, self.ref and self.fastracked inside.
There was a problem hiding this comment.
Note that an @property method could also be used but it would recompute the priority each time it's accessed. Maybe that's better I don't know
There was a problem hiding this comment.
I wasn't sure, can safely use a class method within __init__()?
(Also it needs to be public so it can react to label changes.)
There was a problem hiding this comment.
can safely use a class method within init()?
yes, if the method is accessing already defined/initialized attributes.
it needs to be public so it can react to label changes
then I think a property method is more appropriate.
There was a problem hiding this comment.
a property method would make e.g., "job.priority" actually call the method?
There was a problem hiding this comment.
assuming the pr field of a job is a reference to updated PR data.
if that's not the case, it's easier to have this staticmethod and supply all needed data at the call site.
There was a problem hiding this comment.
How do you requeue ? In the current state, a new MurdockJob instance is created and the previous matching ones are marked as cancelled.
I also thought that the display order must also be taken into account. This is something that is in another data structure, a simple list. So a sort on priority must be added there.
There was a problem hiding this comment.
I would add re-queueing here:
Line 478 in e62397d
(if the job is queued, re-calc its priority and compare to the queued one. if it has changed, don't "return" but fall through to "schedule_job()", which would cancel the old job and create a new, sorted into the queue by priority.)
There was a problem hiding this comment.
I'm a bit lost. What is the use case exactly ?
There was a problem hiding this comment.
The PR blew up from just replacing two unprioritized queues with one prioritized, to making full use of that change. :( I'll update the description.
The test suite is becoming huge I admit. Maybe start by adding a test function in To run the tests, just install tox (pip install tox) and run |
|
80d2e79 to
42b1066
Compare
|
This needs a rebase! |
e0c1b29 to
50b9627
Compare
| if label_name not in config.priorities.labels.keys(): | ||
| return | ||
| elif not self.queued.search_by_pr_number(pull_request.number): | ||
| # skip re-queing if there's no queued job |
There was a problem hiding this comment.
Tiny typo:
| # skip re-queing if there's no queued job | |
| # skip re-queuing if there's no queued job |
|
This also needs another rebase, sorry. There are also some failures reported by the CI |
This PR drops the fasttrack queue and turns the "regular" queue into a priority queue.
It adds configurable priority modifiers (per-branch, per-label) that get applied to queued or (re-)labeled jobs.
Previously, it was possible to "fasttrack" jobs, moving them ahead of "regular" jobs, essentially supporting two priorities.
With this PR, the job priority becomes numeric. This is limiting.
As an actual use-case, RIOT will move to bors for builds that should get merged, but non-bors quickbuilds for PRs.
The bors builds are expected to take >2hrs, whereas the quickbuilds are below 5min.
PR builds should be prioritized over the long bors builds.
Up to this point, two priorities work fine (fasttrack all PR builds).
Now it would be great if some PR builds could be set to a lower priority (for contributors that want to use CI for build testing without hampering workflow), or even higher priority (for important backports or CI fixes).
Also, it would be great if e.g., adding the "CI: high priority") label would update the job's queue position.
And, if "can_fast_ci_build.py" determines a subset build, the priority can be dynamically adapted.
So this PR implements the following changes:
__lt()implementation to MurdockJob (making it sort by priority)priorities:repo-level (.murdock.yml) configurationpriorities:.murdock.ymlconfiguration