Issues
Got error local variable 'group_completion' referenced before assignment in case of constant fail despite retries.
Version
remoulade version: remoulade[rabbitmq,redis]==0.48.0
traceback
Traceback (most recent call last):
File "/home/unprivileged/.local/lib/python3.8/site-packages/remoulade/broker.py", line 168, in emit_after
getattr(middleware, "after_" + signal)(self, *args, **kwargs)
File "/home/unprivileged/.local/lib/python3.8/site-packages/remoulade/middleware/pipelines.py", line 58, in after_process_message
if group_info and not self._group_completed(message, group_info, broker):
File "/home/unprivileged/.local/lib/python3.8/site-packages/remoulade/middleware/pipelines.py", line 129, in _group_completed
group_competed = group_completion >= group_info.children_count
UnboundLocalError: local variable 'group_completion' referenced before assignment
Understanding
During a pipeline that failed for every retries, the context manager remoulade.results.backend.py:ResultBackend.retry catch the error and skip the assigment of variable group_completion. Just after, there is a test on group_completion that can be unassigned.
Proposed fix
adding default assignment of group_completion
/remoulade/middleware/pipelines.py
@@ -123,6 +123,7 @@ class Pipelines(Middleware):
except NoResultBackend as e:
raise NoResultBackend("Pipeline with groups are ony supported with a result backend") from e
+ group_completion = float("-inf") # noqa
with results.backend.retry(broker, message, self.logger):
ttl = results.get_option("result_ttl", broker=broker, message=message)
group_completion = results.backend.increment_group_completion(group_info.group_id, message.message_id, ttl)
group_competed = group_completion >= group_info.children_count
Issues
Got error
local variable 'group_completion' referenced before assignmentin case of constant fail despite retries.Version
remoulade version: remoulade[rabbitmq,redis]==0.48.0
traceback
Understanding
During a pipeline that failed for every retries, the context manager
remoulade.results.backend.py:ResultBackend.retrycatch the error and skip the assigment of variablegroup_completion. Just after, there is a test ongroup_completionthat can be unassigned.Proposed fix
adding default assignment of
group_completion