Skip to content

Commit

Permalink
3.8 compat
Browse files Browse the repository at this point in the history
  • Loading branch information
dandavison committed Oct 2, 2024
1 parent b3bebf8 commit 9355bc2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
from dataclasses import dataclass
from enum import StrEnum
from enum import IntEnum

TASK_QUEUE = "my-task-queue"
WORKFLOW_ID = "my-workflow-id"


class WorkflowExitType(StrEnum):
SUCCESS = "success"
FAILURE = "failure"
CONTINUE_AS_NEW = "continue_as_new"
CANCELLATION = "cancellation"
class WorkflowExitType(IntEnum):
SUCCESS = 0
FAILURE = 1
CONTINUE_AS_NEW = 2
CANCELLATION = 3


@dataclass
class WorkflowInput:
exit_type: WorkflowExitType


class OnWorkflowExitAction(StrEnum):
CONTINUE = "continue"
ABORT_WITH_COMPENSATION = "abort_with_compensation"
class OnWorkflowExitAction(IntEnum):
CONTINUE = 0
ABORT_WITH_COMPENSATION = 1


@dataclass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ async def my_update(self, input: UpdateInput) -> str:
update_task = asyncio.Task(self._my_update())
# 👉 Always use `workflow.wait` instead of `asyncio.wait` in Workflow
# code: asyncio's version is non-deterministic.
first_completed, _ = await workflow.wait(
first_completed, _ = await workflow.wait( # type: ignore
[update_task, self.workflow_exit_exception],
return_when=asyncio.FIRST_COMPLETED,
)
Expand Down

0 comments on commit 9355bc2

Please sign in to comment.