-
Notifications
You must be signed in to change notification settings - Fork 107
Expand file tree
/
Copy pathshared.py
More file actions
70 lines (48 loc) · 1.33 KB
/
shared.py
File metadata and controls
70 lines (48 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
from __future__ import annotations
from dataclasses import dataclass
from temporalio.contrib.workflow_streams import WorkflowStreamState
TASK_QUEUE = "workflow-stream-sample-task-queue"
# Topics published by the workflow / activity.
TOPIC_STATUS = "status"
TOPIC_PROGRESS = "progress"
TOPIC_NEWS = "news"
TOPIC_TICK = "tick"
@dataclass
class OrderInput:
order_id: str
# Carries stream state across continue-as-new. None on a fresh start.
stream_state: WorkflowStreamState | None = None
@dataclass
class StatusEvent:
kind: str
order_id: str
@dataclass
class ProgressEvent:
message: str
@dataclass
class PipelineInput:
pipeline_id: str
# Carries stream state across continue-as-new. None on a fresh start.
stream_state: WorkflowStreamState | None = None
@dataclass
class StageEvent:
stage: str
@dataclass
class HubInput:
hub_id: str
# Carries stream state across continue-as-new. None on a fresh start.
stream_state: WorkflowStreamState | None = None
@dataclass
class NewsEvent:
headline: str
@dataclass
class TickerInput:
count: int = 20
keep_last: int = 3
truncate_every: int = 5
interval_ms: int = 400
# Carries stream state across continue-as-new. None on a fresh start.
stream_state: WorkflowStreamState | None = None
@dataclass
class TickEvent:
n: int