Skip to content

Commit

Permalink
Allowing re-execution of tasks based on a reprocessing the message
Browse files Browse the repository at this point in the history
  • Loading branch information
patkivikram committed Oct 25, 2023
1 parent e61d726 commit 2f23f76
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions dagger/tasks/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,15 +322,21 @@ async def start(
ignore_status: bool = False,
) -> None:
# pre-execute
if self.status.code in [
TaskStatusEnum.COMPLETED.name,
TaskStatusEnum.SKIPPED.name,
] and not self.reprocess_on_message:
if (
self.status.code
in [
TaskStatusEnum.COMPLETED.name,
TaskStatusEnum.SKIPPED.name,
]
and not self.reprocess_on_message
):
return await self.on_complete(
status=self.status, workflow_instance=workflow_instance
)
if (
ignore_status or self.status.code == TaskStatusEnum.NOT_STARTED.name or self.reprocess_on_message
ignore_status
or self.status.code == TaskStatusEnum.NOT_STARTED.name
or self.reprocess_on_message
) and workflow_instance:
self.status = TaskStatus(
code=TaskStatusEnum.EXECUTING.name, value=TaskStatusEnum.EXECUTING.value
Expand Down Expand Up @@ -964,10 +970,14 @@ async def stop(
)

async def start(self, workflow_instance: Optional[ITemplateDAGInstance]) -> None:
if self.status.code in [
TaskStatusEnum.COMPLETED.name,
TaskStatusEnum.SKIPPED.name,
] and not self.reprocess_on_message:
if (
self.status.code
in [
TaskStatusEnum.COMPLETED.name,
TaskStatusEnum.SKIPPED.name,
]
and not self.reprocess_on_message
):
return await self.on_complete(
status=self.status, workflow_instance=workflow_instance
)
Expand Down

0 comments on commit 2f23f76

Please sign in to comment.