-
Notifications
You must be signed in to change notification settings - Fork 35
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
#574 Avoid Recomputing Schedules #616
Conversation
Pull Request Test Coverage Report for Build 4700657181
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice work! Just making sure: the job id itself is unaffected right? (We hand out the job id through the API as a return value for triggering a schedule.)
Yes! In the first trigger, we just return the Job. In the following triggers, we fetch the job and return it (the same job with the same job id). |
Signed-off-by: victor <victor@seita.nl>
… provide a tuple with the paramterers to be considered for the hash. Added some extra info to the docstrings. Signed-off-by: victor <victor@seita.nl>
… has failed. Signed-off-by: victor <victor@seita.nl>
Signed-off-by: victor <victor@seita.nl>
Signed-off-by: victor <victor@seita.nl>
…lds different hashes. Signed-off-by: victor <victor@seita.nl>
This PR is coming along nicely. Don't forget to add the changelog entry. Other than that, it's just a matter of settling what to do with failed jobs. |
Signed-off-by: victor <victor@seita.nl>
…e creation of a new job. Signed-off-by: victor <victor@seita.nl>
Signed-off-by: victor <victor@seita.nl>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool stuff. I have some deeper questions and small asks.
Fixed some typos. Simplified a test. Renamed @redis_cache -> @job_cache. Updated docstrings. Signed-off-by: victor <victor@seita.nl>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just more typos :D
Signed-off-by: F.N. Claessen <felix@seita.nl>
…ments of the function being decorated Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
… assigns a queue, and in case of "requeuing", a queue doesn't need to be reassigned; the job already knows which queue it should go in when it is requeued. Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
I made some commits myself, primarily to address my remaining issues with the documentation and code legibility. I tried to make them small, so you can follow my rationale behind each one. Sorry about the unverified status of my commits (it seems like I somehow managed to make that worse than before). While doing these I also came to the conclusion that the hash keys are not actually stored under some queue-specific segment of our Redis database. Therefore, I believe we can't be sure yet that the hash is unique if we apply the Another question that came up is whether there is any mechanism keeping the cache size at bay. Jobs have a limited lifetime, but here we are adding keys to Redis ourselves, and I suspect that the list just grows unlimited. Is that the case? Finally, I found a if/else case for which no logic is specifically implemented. What happens (/ should happen) if the hash exists but the job id no longer exists in Redis (e.g. after the job's time to live has passed)? |
|
Alas, it looks like they don't. (source) |
Thanks. Then maybe my second idea would help. |
… FLEXMEASURES_JOB_CACHE_TTL. Signed-off-by: victor <victor@seita.nl>
Signed-off-by: victor <victor@seita.nl>
Thanks for the reviews! I've added the Regarding the addition of the post-hook functions
In both cases, this behavior can be overridden by setting the flag With the post-hook functions, we had the following disadvantages:
Regarding the case that the Job has expired, we handle this as follow:
Please, let me know If I'm missing something. Regarding the hash collisions for functions with the same arguments, indeed that could happen. Even though unlikely, to avoid collisions in the future, I'm changing the key to be |
I find that the new default TTL of an hour carries with it considerable weight, given that it scopes the whole caching logic. Two places I could think of that could mention that scope are: the changelog entries, and the documentation page for config variables. The new config variable should be added to that documentation page in any case. |
Signed-off-by: victor <victor@seita.nl>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
…-schedules Signed-off-by: victor <victor@seita.nl>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A very cool PR, thanks!
…elevant state change. Squashed commit of the following: commit 79ef71a Author: victor <victor@seita.nl> Date: Thu Mar 30 15:38:55 2023 +0200 Fixing typos on @deprecated decorator and trigger warnings through loggere. Signed-off-by: victor <victor@seita.nl> commit 7faa6e6 Author: victor <victor@seita.nl> Date: Wed Mar 29 23:28:00 2023 +0200 Adding version of sunset of a function/method to the @deprecated decorator Signed-off-by: victor <victor@seita.nl> commit fe228d2 Author: victor <victor@seita.nl> Date: Mon Mar 27 11:57:32 2023 +0200 Getting location of the new funciton directly from the importable object. Signed-off-by: victor <victor@seita.nl> commit c1be8db Author: victor <victor@seita.nl> Date: Sun Mar 26 23:26:28 2023 +0200 Adding deprecated messages for the functions that were moved. Signed-off-by: victor <victor@seita.nl> commit ac4a232 Author: victor <victor@seita.nl> Date: Thu Mar 23 22:29:48 2023 +0100 Issue #599 Forgot to add `from __future__ import annotations`. Local testing worked as I'm uing Python v3.10. Signed-off-by: victor <victor@seita.nl> commit 3ff0571 Author: victor <victor@seita.nl> Date: Thu Mar 23 22:02:11 2023 +0100 Issue #599 Moving get_asset_group_queries from data/services to data/queries Signed-off-by: victor <victor@seita.nl> commit 53fc214 Author: victor <victor@seita.nl> Date: Thu Mar 23 20:30:31 2023 +0100 Issue #599 Moving DataSources fetching from query to services. Signed-off-by: victor <victor@seita.nl> Signed-off-by: victor <victor@seita.nl>
…hout a relevant state change." This reverts commit a694443.
Closes #574