-
-
Notifications
You must be signed in to change notification settings - Fork 175
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
Use function's keep_results configuration when storing failed jobs results #433
base: main
Are you sure you want to change the base?
Use function's keep_results configuration when storing failed jobs results #433
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #433 +/- ##
==========================================
- Coverage 98.40% 98.03% -0.37%
==========================================
Files 11 11
Lines 1063 1071 +8
Branches 200 205 +5
==========================================
+ Hits 1046 1050 +4
- Misses 8 10 +2
- Partials 9 11 +2
Continue to review full report in Codecov by Sentry.
|
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.
Otherwise I think this looks okay, @JonasKs WDYT?
@@ -483,6 +483,7 @@ async def run_job(self, job_id: str, score: int) -> None: # noqa: C901 | |||
abort_job = False | |||
|
|||
function_name, enqueue_time_ms = '<unknown>', 0 | |||
function: Optional[Union[Function, CronJob]] = None |
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.
function: Optional[Union[Function, CronJob]] = None | |
function: Union[Function, CronJob, None] = None |
with contextlib.suppress(KeyError): | ||
function = self.functions[function_name] |
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.
with contextlib.suppress(KeyError): | |
function = self.functions[function_name] | |
function = self.functions.get(function_name) |
@@ -701,7 +703,9 @@ async def finish_job( | |||
tr.delete(*delete_keys) # type: ignore[unused-coroutine] | |||
await tr.execute() | |||
|
|||
async def finish_failed_job(self, job_id: str, result_data: Optional[bytes]) -> None: | |||
async def finish_failed_job( | |||
self, job_id: str, result_data: Optional[bytes], function: Optional[Union[Function, CronJob]] |
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.
self, job_id: str, result_data: Optional[bytes], function: Optional[Union[Function, CronJob]] | |
self, job_id: str, result_data: Optional[bytes], function: Union[Function, CronJob, None] |
Agree, I think this looks good. 😊 |
Thanks for looking at this one! Any chance this can enter the v0.26.0b1 release? :) |
Taking a stab at using a function's (or cron job's) configuration for keeping the job results when the job fails.
I don't think this is a complete solution yet. There are a few cases where the job results are written to redis using the Worker's configuration because we can't get the Function in order to use it's config.
But maybe this is a situation where it's good enough to improve the situation for the most common situation?
Addresses #417
Relates to #416