Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions mistral/engine/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1078,6 +1078,8 @@ def _get_input_dicts(self, with_items_values, prev_index=-1):
ctx = {}

index = prev_index + concurrency
if self.is_index_invalid(index):
return

for k, v in with_items_values.items():
ctx.update({k: v[index]})
Expand All @@ -1098,6 +1100,19 @@ def _get_input_dicts(self, with_items_values, prev_index=-1):
result.append((i, self._get_action_input(ctx)))

return result

def is_index_invalid(self, index):
with db_api.named_lock('with-items-%s' % self.task_ex.id):

indices = db_api.get_accepted_executions_indexes(
id=self.task_ex.id,
workflow=self.task_ex.spec.get('workflow'),
accepted=True
)

finished = [idx[0] for idx in indices]

return index in finished

def _get_with_items_context(self):
return self.task_ex.runtime_context.get(
Expand Down
Loading