[14.0] Add graph of dependencies#403
Merged
OCA-git-bot merged 41 commits intoOCA:14.0from Jun 1, 2022
Merged
Conversation
This was referenced Jan 29, 2022
Closed
d46b548 to
3ca0f6f
Compare
f0b56b9 to
56be8a8
Compare
test_queue_job will create channels root.sub and root.sub.sub, so the tests doing the same thing will fail with a unique constraint error.
When displayed in a tab, the widget show the nodes offset, the d3 network is probably confused by the size or visibility of its canvas. Install a listener on tabs to trigger a fit() on the network.
A graph of jobs always share the same graph_uuid, which can be used to group jobs, but is also a faster way to find all the jobs of the graph. Then we can use the dependencies field to build the whole graph from the pre-selection of jobs.
Jobs waiting that their dependencies are executed cannot be requeued. They have to keep waiting their turn.
As jobs are created in the setup, but not always delayed, the __del__ warning that the job was not delayed is triggered. Create only the jobs necessary for each test.
* mock_jobs context manager with assert methods to check enqueued jobs * jobs are not stored in database, yet they can be inspected and performed during the test * the context manager works with graphs enqueued by delayable and with with_delay() * direct execution of jobs works with graphs by executing them synchronously following their topological sort
The previous implementation was incomplete, as it was setting the graph_uuid when `Job.add_depends()` was called. It had the advantage of being correct when (for e.g. a test) manually created a Job and called `add_depends()`, but it could not work when in some situations involving a group where one of the job has no job depending on it. Also, remove ``Job.add_reverse_depends()`` which is not used.
When showing large graphs, like 300 jobs (not really a real life case maybe), the graph takes a dozen of seconds to render. Disabling the stabilization helps a lot.
* Renaming the TestXxx models in test_queue_job is because of pytest that complains, confusing them for test classes * logger.warn is deprecated in favor of logger.warning * Add invalidation of cache in SQL update that enqueue dependent jobs * Flush in a test, the same is done currently in the controller * Weird one: we can no longer compare the bound methods of the models, compare their __func__ which is equal.
The assert fails to show the method's details if we store the __func__ in JobCall. Anyway, it was hackish to change the content of "method".
The fact that mocks are used is an implementation detail, and is actually hidden to the end user of the test API.
on_done() is maybe a better choice, it is less ambiguous than then() (clearer on the fact it happens on done()) and done() (less confusion with set_done()). I'll do the renaming soon, unless you have other suggestions. Ref: OCA#154 (comment)
Member
Author
simahawk
approved these changes
Jun 1, 2022
Contributor
simahawk
left a comment
There was a problem hiding this comment.
Skimmed quickly through it, can't find anything bad... but I trust you did your homework 😜
COOOOL THANKS!
Member
|
I totally trust the author credentials :) |
Contributor
|
/ocabot merge major |
Contributor
|
This PR looks fantastic, let's merge it! |
Contributor
|
Congratulations, your PR was merged at b8311a4. Thanks a lot for contributing to OCA. ❤️ |
This was referenced Mar 6, 2024
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migration of #154, details on the link.
You can test enqueuing a graph a jobs with test jobs by going on the runboat instance and doing a request on
/queue_job/create_test_job?size=30that will generate a random graph of 30 jobs. Jobs are not executed, but you can look at the dependency graphs ;)