Conversation
sylvinus
reviewed
Feb 20, 2017
| self.done_jobs = 0 | ||
| self.max_jobs = self.config["max_jobs"] | ||
| max_time = self.config.get("max_time") | ||
| self.max_time = datetime.timedelta(seconds=max_time) if max_time is not None else None |
Contributor
There was a problem hiding this comment.
à priori max_time sera toujours défini (comme il est dans la config) donc le .get() et le test sur None sont inutiles
|
|
||
| parser.add_argument( | ||
| '--max_time', | ||
| default=0, |
Contributor
There was a problem hiding this comment.
pas très grave, mais plutôt float ?
| def test_worker_interrupt_after_max_time(worker): | ||
| worker.start(flags="--greenlets=2 --max_time=1", queues="test1 default") | ||
|
|
||
| worker.send_tasks("tests.tasks.general.Add", [{"a": i, "b": 1, "sleep": 1} for i in range(5)], block=False) |
Contributor
There was a problem hiding this comment.
j'aurais bien fait max_time=2 & sleep=3 pour être sûrs des timings
|
|
||
| worker.send_tasks("tests.tasks.general.Add", [{"a": i, "b": 1, "sleep": 1} for i in range(5)], block=False) | ||
|
|
||
| time.sleep(3) |
| assert Queue("default").size() == 3 | ||
|
|
||
|
|
||
| def test_worker_runs_but_interrupt_after_max_time(worker): |
Contributor
There was a problem hiding this comment.
pas bien compris ce que ca teste comparé au précédent ?
Contributor
Author
There was a problem hiding this comment.
ca récupère juste le résultat pour vérifier qu'il a été bien calculé
Contributor
There was a problem hiding this comment.
je combinerais bien les 2 en un seul alors
added 2 commits
February 20, 2017 18:28
Contributor
|
Looks great! |
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.
#138