Last active
February 27, 2025 23:59
-
-
Save inishchith/be87bed00b8bec668182938cee5c1997 to your computer and use it in GitHub Desktop.
Temporal workflow with activities simulating a i/o heavy task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "events": [ | |
| { | |
| "eventId": "1", | |
| "eventTime": "2025-02-27T23:44:34.028406Z", | |
| "eventType": "EVENT_TYPE_WORKFLOW_EXECUTION_STARTED", | |
| "taskId": "4208310", | |
| "workflowExecutionStartedEventAttributes": { | |
| "workflowType": { | |
| "name": "MyWorkflow" | |
| }, | |
| "taskQueue": { | |
| "name": "my-task-queue", | |
| "kind": "TASK_QUEUE_KIND_NORMAL" | |
| }, | |
| "workflowTaskTimeout": "10s", | |
| "originalExecutionRunId": "b6c3c705-340b-45fb-9abb-f0ea6806d155", | |
| "identity": "28513@Nishchiths-MacBook-Pro.local", | |
| "firstExecutionRunId": "b6c3c705-340b-45fb-9abb-f0ea6806d155", | |
| "attempt": 1, | |
| "firstWorkflowTaskBackoff": "0s", | |
| "workflowId": "my-workflow" | |
| } | |
| }, | |
| { | |
| "eventId": "2", | |
| "eventTime": "2025-02-27T23:44:34.028555Z", | |
| "eventType": "EVENT_TYPE_WORKFLOW_TASK_SCHEDULED", | |
| "taskId": "4208311", | |
| "workflowTaskScheduledEventAttributes": { | |
| "taskQueue": { | |
| "name": "my-task-queue", | |
| "kind": "TASK_QUEUE_KIND_NORMAL" | |
| }, | |
| "startToCloseTimeout": "10s", | |
| "attempt": 1 | |
| } | |
| }, | |
| { | |
| "eventId": "3", | |
| "eventTime": "2025-02-27T23:44:34.068953Z", | |
| "eventType": "EVENT_TYPE_WORKFLOW_TASK_STARTED", | |
| "taskId": "4208318", | |
| "workflowTaskStartedEventAttributes": { | |
| "scheduledEventId": "2", | |
| "identity": "28513@Nishchiths-MacBook-Pro.local", | |
| "requestId": "c7461f76-698c-4c08-9d2d-e4fe95c59611", | |
| "historySizeBytes": "498", | |
| "workerVersion": { | |
| "buildId": "b68844d9cb9e08974ca8fe86d492859e" | |
| } | |
| } | |
| }, | |
| { | |
| "eventId": "4", | |
| "eventTime": "2025-02-27T23:44:34.080691Z", | |
| "eventType": "EVENT_TYPE_WORKFLOW_TASK_COMPLETED", | |
| "taskId": "4208322", | |
| "workflowTaskCompletedEventAttributes": { | |
| "scheduledEventId": "2", | |
| "startedEventId": "3", | |
| "identity": "28513@Nishchiths-MacBook-Pro.local", | |
| "workerVersion": { | |
| "buildId": "b68844d9cb9e08974ca8fe86d492859e" | |
| }, | |
| "sdkMetadata": { | |
| "coreUsedFlags": [ | |
| 1, | |
| 2, | |
| 3 | |
| ] | |
| }, | |
| "meteringMetadata": {} | |
| } | |
| }, | |
| { | |
| "eventId": "5", | |
| "eventTime": "2025-02-27T23:44:34.080759Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_SCHEDULED", | |
| "taskId": "4208323", | |
| "activityTaskScheduledEventAttributes": { | |
| "activityId": "1", | |
| "activityType": { | |
| "name": "first_activity" | |
| }, | |
| "taskQueue": { | |
| "name": "my-task-queue", | |
| "kind": "TASK_QUEUE_KIND_NORMAL" | |
| }, | |
| "header": {}, | |
| "scheduleToCloseTimeout": "86400s", | |
| "scheduleToStartTimeout": "86400s", | |
| "startToCloseTimeout": "86400s", | |
| "heartbeatTimeout": "10s", | |
| "workflowTaskCompletedEventId": "4", | |
| "retryPolicy": { | |
| "initialInterval": "1s", | |
| "backoffCoefficient": 2, | |
| "maximumInterval": "100s", | |
| "maximumAttempts": 4 | |
| }, | |
| "useWorkflowBuildId": true | |
| } | |
| }, | |
| { | |
| "eventId": "6", | |
| "eventTime": "2025-02-27T23:44:34.080786Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_SCHEDULED", | |
| "taskId": "4208324", | |
| "activityTaskScheduledEventAttributes": { | |
| "activityId": "2", | |
| "activityType": { | |
| "name": "first_activity" | |
| }, | |
| "taskQueue": { | |
| "name": "my-task-queue", | |
| "kind": "TASK_QUEUE_KIND_NORMAL" | |
| }, | |
| "header": {}, | |
| "scheduleToCloseTimeout": "86400s", | |
| "scheduleToStartTimeout": "86400s", | |
| "startToCloseTimeout": "86400s", | |
| "heartbeatTimeout": "10s", | |
| "workflowTaskCompletedEventId": "4", | |
| "retryPolicy": { | |
| "initialInterval": "1s", | |
| "backoffCoefficient": 2, | |
| "maximumInterval": "100s", | |
| "maximumAttempts": 4 | |
| }, | |
| "useWorkflowBuildId": true | |
| } | |
| }, | |
| { | |
| "eventId": "7", | |
| "eventTime": "2025-02-27T23:44:34.080803Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_SCHEDULED", | |
| "taskId": "4208325", | |
| "activityTaskScheduledEventAttributes": { | |
| "activityId": "3", | |
| "activityType": { | |
| "name": "first_activity" | |
| }, | |
| "taskQueue": { | |
| "name": "my-task-queue", | |
| "kind": "TASK_QUEUE_KIND_NORMAL" | |
| }, | |
| "header": {}, | |
| "scheduleToCloseTimeout": "86400s", | |
| "scheduleToStartTimeout": "86400s", | |
| "startToCloseTimeout": "86400s", | |
| "heartbeatTimeout": "10s", | |
| "workflowTaskCompletedEventId": "4", | |
| "retryPolicy": { | |
| "initialInterval": "1s", | |
| "backoffCoefficient": 2, | |
| "maximumInterval": "100s", | |
| "maximumAttempts": 4 | |
| }, | |
| "useWorkflowBuildId": true | |
| } | |
| }, | |
| { | |
| "eventId": "8", | |
| "eventTime": "2025-02-27T23:44:34.080822Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_SCHEDULED", | |
| "taskId": "4208326", | |
| "activityTaskScheduledEventAttributes": { | |
| "activityId": "4", | |
| "activityType": { | |
| "name": "first_activity" | |
| }, | |
| "taskQueue": { | |
| "name": "my-task-queue", | |
| "kind": "TASK_QUEUE_KIND_NORMAL" | |
| }, | |
| "header": {}, | |
| "scheduleToCloseTimeout": "86400s", | |
| "scheduleToStartTimeout": "86400s", | |
| "startToCloseTimeout": "86400s", | |
| "heartbeatTimeout": "10s", | |
| "workflowTaskCompletedEventId": "4", | |
| "retryPolicy": { | |
| "initialInterval": "1s", | |
| "backoffCoefficient": 2, | |
| "maximumInterval": "100s", | |
| "maximumAttempts": 4 | |
| }, | |
| "useWorkflowBuildId": true | |
| } | |
| }, | |
| { | |
| "eventId": "9", | |
| "eventTime": "2025-02-27T23:44:34.080835Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_SCHEDULED", | |
| "taskId": "4208327", | |
| "activityTaskScheduledEventAttributes": { | |
| "activityId": "5", | |
| "activityType": { | |
| "name": "first_activity" | |
| }, | |
| "taskQueue": { | |
| "name": "my-task-queue", | |
| "kind": "TASK_QUEUE_KIND_NORMAL" | |
| }, | |
| "header": {}, | |
| "scheduleToCloseTimeout": "86400s", | |
| "scheduleToStartTimeout": "86400s", | |
| "startToCloseTimeout": "86400s", | |
| "heartbeatTimeout": "10s", | |
| "workflowTaskCompletedEventId": "4", | |
| "retryPolicy": { | |
| "initialInterval": "1s", | |
| "backoffCoefficient": 2, | |
| "maximumInterval": "100s", | |
| "maximumAttempts": 4 | |
| }, | |
| "useWorkflowBuildId": true | |
| } | |
| }, | |
| { | |
| "eventId": "10", | |
| "eventTime": "2025-02-27T23:44:34.080847Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_SCHEDULED", | |
| "taskId": "4208328", | |
| "activityTaskScheduledEventAttributes": { | |
| "activityId": "6", | |
| "activityType": { | |
| "name": "first_activity" | |
| }, | |
| "taskQueue": { | |
| "name": "my-task-queue", | |
| "kind": "TASK_QUEUE_KIND_NORMAL" | |
| }, | |
| "header": {}, | |
| "scheduleToCloseTimeout": "86400s", | |
| "scheduleToStartTimeout": "86400s", | |
| "startToCloseTimeout": "86400s", | |
| "heartbeatTimeout": "10s", | |
| "workflowTaskCompletedEventId": "4", | |
| "retryPolicy": { | |
| "initialInterval": "1s", | |
| "backoffCoefficient": 2, | |
| "maximumInterval": "100s", | |
| "maximumAttempts": 4 | |
| }, | |
| "useWorkflowBuildId": true | |
| } | |
| }, | |
| { | |
| "eventId": "11", | |
| "eventTime": "2025-02-27T23:44:34.080866Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_SCHEDULED", | |
| "taskId": "4208329", | |
| "activityTaskScheduledEventAttributes": { | |
| "activityId": "7", | |
| "activityType": { | |
| "name": "first_activity" | |
| }, | |
| "taskQueue": { | |
| "name": "my-task-queue", | |
| "kind": "TASK_QUEUE_KIND_NORMAL" | |
| }, | |
| "header": {}, | |
| "scheduleToCloseTimeout": "86400s", | |
| "scheduleToStartTimeout": "86400s", | |
| "startToCloseTimeout": "86400s", | |
| "heartbeatTimeout": "10s", | |
| "workflowTaskCompletedEventId": "4", | |
| "retryPolicy": { | |
| "initialInterval": "1s", | |
| "backoffCoefficient": 2, | |
| "maximumInterval": "100s", | |
| "maximumAttempts": 4 | |
| }, | |
| "useWorkflowBuildId": true | |
| } | |
| }, | |
| { | |
| "eventId": "12", | |
| "eventTime": "2025-02-27T23:44:34.080883Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_SCHEDULED", | |
| "taskId": "4208330", | |
| "activityTaskScheduledEventAttributes": { | |
| "activityId": "8", | |
| "activityType": { | |
| "name": "first_activity" | |
| }, | |
| "taskQueue": { | |
| "name": "my-task-queue", | |
| "kind": "TASK_QUEUE_KIND_NORMAL" | |
| }, | |
| "header": {}, | |
| "scheduleToCloseTimeout": "86400s", | |
| "scheduleToStartTimeout": "86400s", | |
| "startToCloseTimeout": "86400s", | |
| "heartbeatTimeout": "10s", | |
| "workflowTaskCompletedEventId": "4", | |
| "retryPolicy": { | |
| "initialInterval": "1s", | |
| "backoffCoefficient": 2, | |
| "maximumInterval": "100s", | |
| "maximumAttempts": 4 | |
| }, | |
| "useWorkflowBuildId": true | |
| } | |
| }, | |
| { | |
| "eventId": "13", | |
| "eventTime": "2025-02-27T23:44:34.080895Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_SCHEDULED", | |
| "taskId": "4208331", | |
| "activityTaskScheduledEventAttributes": { | |
| "activityId": "9", | |
| "activityType": { | |
| "name": "first_activity" | |
| }, | |
| "taskQueue": { | |
| "name": "my-task-queue", | |
| "kind": "TASK_QUEUE_KIND_NORMAL" | |
| }, | |
| "header": {}, | |
| "scheduleToCloseTimeout": "86400s", | |
| "scheduleToStartTimeout": "86400s", | |
| "startToCloseTimeout": "86400s", | |
| "heartbeatTimeout": "10s", | |
| "workflowTaskCompletedEventId": "4", | |
| "retryPolicy": { | |
| "initialInterval": "1s", | |
| "backoffCoefficient": 2, | |
| "maximumInterval": "100s", | |
| "maximumAttempts": 4 | |
| }, | |
| "useWorkflowBuildId": true | |
| } | |
| }, | |
| { | |
| "eventId": "14", | |
| "eventTime": "2025-02-27T23:44:34.080910Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_SCHEDULED", | |
| "taskId": "4208332", | |
| "activityTaskScheduledEventAttributes": { | |
| "activityId": "10", | |
| "activityType": { | |
| "name": "first_activity" | |
| }, | |
| "taskQueue": { | |
| "name": "my-task-queue", | |
| "kind": "TASK_QUEUE_KIND_NORMAL" | |
| }, | |
| "header": {}, | |
| "scheduleToCloseTimeout": "86400s", | |
| "scheduleToStartTimeout": "86400s", | |
| "startToCloseTimeout": "86400s", | |
| "heartbeatTimeout": "10s", | |
| "workflowTaskCompletedEventId": "4", | |
| "retryPolicy": { | |
| "initialInterval": "1s", | |
| "backoffCoefficient": 2, | |
| "maximumInterval": "100s", | |
| "maximumAttempts": 4 | |
| }, | |
| "useWorkflowBuildId": true | |
| } | |
| }, | |
| { | |
| "eventId": "15", | |
| "eventTime": "2025-02-27T23:44:34.117772Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_STARTED", | |
| "taskId": "4208357", | |
| "activityTaskStartedEventAttributes": { | |
| "scheduledEventId": "14", | |
| "identity": "28513@Nishchiths-MacBook-Pro.local", | |
| "requestId": "53e7c19d-02d4-46b3-b504-5f4d784c5b49", | |
| "attempt": 1, | |
| "workerVersion": { | |
| "buildId": "b68844d9cb9e08974ca8fe86d492859e" | |
| } | |
| } | |
| }, | |
| { | |
| "eventId": "16", | |
| "eventTime": "2025-02-27T23:44:38.580526Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_COMPLETED", | |
| "taskId": "4208358", | |
| "activityTaskCompletedEventAttributes": { | |
| "result": { | |
| "payloads": [ | |
| { | |
| "metadata": { | |
| "encoding": "YmluYXJ5L251bGw=" | |
| } | |
| } | |
| ] | |
| }, | |
| "scheduledEventId": "14", | |
| "startedEventId": "15", | |
| "identity": "28513@Nishchiths-MacBook-Pro.local" | |
| } | |
| }, | |
| { | |
| "eventId": "17", | |
| "eventTime": "2025-02-27T23:44:38.580538Z", | |
| "eventType": "EVENT_TYPE_WORKFLOW_TASK_SCHEDULED", | |
| "taskId": "4208359", | |
| "workflowTaskScheduledEventAttributes": { | |
| "taskQueue": { | |
| "name": "28513@Nishchiths-MacBook-Pro.local-0a8aad66d1d9423a904ce018ec8bdc62", | |
| "kind": "TASK_QUEUE_KIND_STICKY", | |
| "normalName": "my-task-queue" | |
| }, | |
| "startToCloseTimeout": "10s", | |
| "attempt": 1 | |
| } | |
| }, | |
| { | |
| "eventId": "18", | |
| "eventTime": "2025-02-27T23:44:38.588465Z", | |
| "eventType": "EVENT_TYPE_WORKFLOW_TASK_STARTED", | |
| "taskId": "4208364", | |
| "workflowTaskStartedEventAttributes": { | |
| "scheduledEventId": "17", | |
| "identity": "28513@Nishchiths-MacBook-Pro.local", | |
| "requestId": "0d007c22-73a9-4bd4-b9ff-d900c276c472", | |
| "historySizeBytes": "2262", | |
| "workerVersion": { | |
| "buildId": "b68844d9cb9e08974ca8fe86d492859e" | |
| } | |
| } | |
| }, | |
| { | |
| "eventId": "19", | |
| "eventTime": "2025-02-27T23:44:47.246273Z", | |
| "eventType": "EVENT_TYPE_WORKFLOW_TASK_COMPLETED", | |
| "taskId": "4208389", | |
| "workflowTaskCompletedEventAttributes": { | |
| "scheduledEventId": "17", | |
| "startedEventId": "18", | |
| "identity": "28513@Nishchiths-MacBook-Pro.local", | |
| "workerVersion": { | |
| "buildId": "b68844d9cb9e08974ca8fe86d492859e" | |
| }, | |
| "sdkMetadata": {}, | |
| "meteringMetadata": {} | |
| } | |
| }, | |
| { | |
| "eventId": "20", | |
| "eventTime": "2025-02-27T23:44:34.119852Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_STARTED", | |
| "taskId": "4208390", | |
| "activityTaskStartedEventAttributes": { | |
| "scheduledEventId": "9", | |
| "identity": "28513@Nishchiths-MacBook-Pro.local", | |
| "requestId": "3c0bfcaa-e3a2-4b3f-868e-9808cc2b166a", | |
| "attempt": 1, | |
| "workerVersion": { | |
| "buildId": "b68844d9cb9e08974ca8fe86d492859e" | |
| } | |
| } | |
| }, | |
| { | |
| "eventId": "21", | |
| "eventTime": "2025-02-27T23:44:42.948589Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_COMPLETED", | |
| "taskId": "4208391", | |
| "activityTaskCompletedEventAttributes": { | |
| "result": { | |
| "payloads": [ | |
| { | |
| "metadata": { | |
| "encoding": "YmluYXJ5L251bGw=" | |
| } | |
| } | |
| ] | |
| }, | |
| "scheduledEventId": "9", | |
| "startedEventId": "20", | |
| "identity": "28513@Nishchiths-MacBook-Pro.local" | |
| } | |
| }, | |
| { | |
| "eventId": "22", | |
| "eventTime": "2025-02-27T23:44:47.246331Z", | |
| "eventType": "EVENT_TYPE_WORKFLOW_TASK_SCHEDULED", | |
| "taskId": "4208392", | |
| "workflowTaskScheduledEventAttributes": { | |
| "taskQueue": { | |
| "name": "28513@Nishchiths-MacBook-Pro.local-0a8aad66d1d9423a904ce018ec8bdc62", | |
| "kind": "TASK_QUEUE_KIND_STICKY", | |
| "normalName": "my-task-queue" | |
| }, | |
| "startToCloseTimeout": "10s", | |
| "attempt": 1 | |
| } | |
| }, | |
| { | |
| "eventId": "23", | |
| "eventTime": "2025-02-27T23:44:47.246338Z", | |
| "eventType": "EVENT_TYPE_WORKFLOW_TASK_STARTED", | |
| "taskId": "4208393", | |
| "workflowTaskStartedEventAttributes": { | |
| "scheduledEventId": "22", | |
| "identity": "28513@Nishchiths-MacBook-Pro.local", | |
| "requestId": "request-from-RespondWorkflowTaskCompleted", | |
| "historySizeBytes": "2405", | |
| "workerVersion": { | |
| "buildId": "b68844d9cb9e08974ca8fe86d492859e" | |
| } | |
| } | |
| }, | |
| { | |
| "eventId": "24", | |
| "eventTime": "2025-02-27T23:44:55.857354Z", | |
| "eventType": "EVENT_TYPE_WORKFLOW_TASK_COMPLETED", | |
| "taskId": "4208398", | |
| "workflowTaskCompletedEventAttributes": { | |
| "scheduledEventId": "22", | |
| "startedEventId": "23", | |
| "identity": "28513@Nishchiths-MacBook-Pro.local", | |
| "workerVersion": { | |
| "buildId": "b68844d9cb9e08974ca8fe86d492859e" | |
| }, | |
| "sdkMetadata": {}, | |
| "meteringMetadata": {} | |
| } | |
| }, | |
| { | |
| "eventId": "25", | |
| "eventTime": "2025-02-27T23:45:11.139193Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_STARTED", | |
| "taskId": "4208437", | |
| "activityTaskStartedEventAttributes": { | |
| "scheduledEventId": "6", | |
| "identity": "28513@Nishchiths-MacBook-Pro.local", | |
| "requestId": "330364ef-eab7-4b08-84e5-ff21a1705051", | |
| "attempt": 4, | |
| "lastFailure": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| } | |
| } | |
| }, | |
| { | |
| "eventId": "26", | |
| "eventTime": "2025-02-27T23:45:21.145504Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_TIMED_OUT", | |
| "taskId": "4208438", | |
| "activityTaskTimedOutEventAttributes": { | |
| "failure": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "cause": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| }, | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| }, | |
| "scheduledEventId": "6", | |
| "startedEventId": "25", | |
| "retryState": "RETRY_STATE_MAXIMUM_ATTEMPTS_REACHED" | |
| } | |
| }, | |
| { | |
| "eventId": "27", | |
| "eventTime": "2025-02-27T23:45:21.145523Z", | |
| "eventType": "EVENT_TYPE_WORKFLOW_TASK_SCHEDULED", | |
| "taskId": "4208439", | |
| "workflowTaskScheduledEventAttributes": { | |
| "taskQueue": { | |
| "name": "28513@Nishchiths-MacBook-Pro.local-0a8aad66d1d9423a904ce018ec8bdc62", | |
| "kind": "TASK_QUEUE_KIND_STICKY", | |
| "normalName": "my-task-queue" | |
| }, | |
| "startToCloseTimeout": "10s", | |
| "attempt": 1 | |
| } | |
| }, | |
| { | |
| "eventId": "28", | |
| "eventTime": "2025-02-27T23:45:21.154866Z", | |
| "eventType": "EVENT_TYPE_WORKFLOW_TASK_STARTED", | |
| "taskId": "4208444", | |
| "workflowTaskStartedEventAttributes": { | |
| "scheduledEventId": "27", | |
| "identity": "28513@Nishchiths-MacBook-Pro.local", | |
| "requestId": "c70d3983-cd8c-411e-9097-64f850a1ded7", | |
| "historySizeBytes": "3509", | |
| "workerVersion": { | |
| "buildId": "b68844d9cb9e08974ca8fe86d492859e" | |
| } | |
| } | |
| }, | |
| { | |
| "eventId": "29", | |
| "eventTime": "2025-02-27T23:45:26.580567Z", | |
| "eventType": "EVENT_TYPE_WORKFLOW_TASK_FAILED", | |
| "taskId": "4208449", | |
| "workflowTaskFailedEventAttributes": { | |
| "scheduledEventId": "27", | |
| "startedEventId": "28", | |
| "cause": "WORKFLOW_TASK_FAILED_CAUSE_UNHANDLED_COMMAND", | |
| "failure": { | |
| "message": "UnhandledCommand", | |
| "serverFailureInfo": {} | |
| }, | |
| "identity": "28513@Nishchiths-MacBook-Pro.local" | |
| } | |
| }, | |
| { | |
| "eventId": "30", | |
| "eventTime": "2025-02-27T23:45:12.138513Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_STARTED", | |
| "taskId": "4208450", | |
| "activityTaskStartedEventAttributes": { | |
| "scheduledEventId": "12", | |
| "identity": "28513@Nishchiths-MacBook-Pro.local", | |
| "requestId": "34f75e5e-defc-4d35-a683-e5b480886ae8", | |
| "attempt": 4, | |
| "lastFailure": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| } | |
| } | |
| }, | |
| { | |
| "eventId": "31", | |
| "eventTime": "2025-02-27T23:45:13.138956Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_STARTED", | |
| "taskId": "4208451", | |
| "activityTaskStartedEventAttributes": { | |
| "scheduledEventId": "5", | |
| "identity": "28513@Nishchiths-MacBook-Pro.local", | |
| "requestId": "f7be3d39-3f5a-49bd-b0fe-ae5ac0ee557b", | |
| "attempt": 4, | |
| "lastFailure": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| } | |
| } | |
| }, | |
| { | |
| "eventId": "32", | |
| "eventTime": "2025-02-27T23:45:13.142524Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_STARTED", | |
| "taskId": "4208452", | |
| "activityTaskStartedEventAttributes": { | |
| "scheduledEventId": "8", | |
| "identity": "28513@Nishchiths-MacBook-Pro.local", | |
| "requestId": "40f7931b-d86d-4889-86a9-6541e213f4ec", | |
| "attempt": 4, | |
| "lastFailure": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| } | |
| } | |
| }, | |
| { | |
| "eventId": "33", | |
| "eventTime": "2025-02-27T23:45:13.143901Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_STARTED", | |
| "taskId": "4208453", | |
| "activityTaskStartedEventAttributes": { | |
| "scheduledEventId": "7", | |
| "identity": "28513@Nishchiths-MacBook-Pro.local", | |
| "requestId": "68e67063-d1cd-485d-a841-b0c32dc33965", | |
| "attempt": 4, | |
| "lastFailure": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| } | |
| } | |
| }, | |
| { | |
| "eventId": "34", | |
| "eventTime": "2025-02-27T23:45:13.145302Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_STARTED", | |
| "taskId": "4208454", | |
| "activityTaskStartedEventAttributes": { | |
| "scheduledEventId": "11", | |
| "identity": "28513@Nishchiths-MacBook-Pro.local", | |
| "requestId": "3918fb95-8753-4937-8a75-457d6c15c5f0", | |
| "attempt": 4, | |
| "lastFailure": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| } | |
| } | |
| }, | |
| { | |
| "eventId": "35", | |
| "eventTime": "2025-02-27T23:45:13.146069Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_STARTED", | |
| "taskId": "4208455", | |
| "activityTaskStartedEventAttributes": { | |
| "scheduledEventId": "13", | |
| "identity": "28513@Nishchiths-MacBook-Pro.local", | |
| "requestId": "5c8bf2c5-b748-4d09-974e-54d148a74f15", | |
| "attempt": 4, | |
| "lastFailure": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| } | |
| } | |
| }, | |
| { | |
| "eventId": "36", | |
| "eventTime": "2025-02-27T23:45:13.146822Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_STARTED", | |
| "taskId": "4208456", | |
| "activityTaskStartedEventAttributes": { | |
| "scheduledEventId": "10", | |
| "identity": "28513@Nishchiths-MacBook-Pro.local", | |
| "requestId": "52c19fbc-8381-4d30-8eac-7dbd8954f113", | |
| "attempt": 4, | |
| "lastFailure": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| } | |
| } | |
| }, | |
| { | |
| "eventId": "37", | |
| "eventTime": "2025-02-27T23:45:22.143671Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_TIMED_OUT", | |
| "taskId": "4208457", | |
| "activityTaskTimedOutEventAttributes": { | |
| "failure": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "cause": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| }, | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| }, | |
| "scheduledEventId": "12", | |
| "startedEventId": "30", | |
| "retryState": "RETRY_STATE_MAXIMUM_ATTEMPTS_REACHED" | |
| } | |
| }, | |
| { | |
| "eventId": "38", | |
| "eventTime": "2025-02-27T23:45:23.156622Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_TIMED_OUT", | |
| "taskId": "4208458", | |
| "activityTaskTimedOutEventAttributes": { | |
| "failure": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "cause": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| }, | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| }, | |
| "scheduledEventId": "5", | |
| "startedEventId": "31", | |
| "retryState": "RETRY_STATE_MAXIMUM_ATTEMPTS_REACHED" | |
| } | |
| }, | |
| { | |
| "eventId": "39", | |
| "eventTime": "2025-02-27T23:45:23.156633Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_TIMED_OUT", | |
| "taskId": "4208459", | |
| "activityTaskTimedOutEventAttributes": { | |
| "failure": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "cause": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| }, | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| }, | |
| "scheduledEventId": "8", | |
| "startedEventId": "32", | |
| "retryState": "RETRY_STATE_MAXIMUM_ATTEMPTS_REACHED" | |
| } | |
| }, | |
| { | |
| "eventId": "40", | |
| "eventTime": "2025-02-27T23:45:23.156640Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_TIMED_OUT", | |
| "taskId": "4208460", | |
| "activityTaskTimedOutEventAttributes": { | |
| "failure": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "cause": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| }, | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| }, | |
| "scheduledEventId": "7", | |
| "startedEventId": "33", | |
| "retryState": "RETRY_STATE_MAXIMUM_ATTEMPTS_REACHED" | |
| } | |
| }, | |
| { | |
| "eventId": "41", | |
| "eventTime": "2025-02-27T23:45:23.156646Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_TIMED_OUT", | |
| "taskId": "4208461", | |
| "activityTaskTimedOutEventAttributes": { | |
| "failure": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "cause": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| }, | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| }, | |
| "scheduledEventId": "11", | |
| "startedEventId": "34", | |
| "retryState": "RETRY_STATE_MAXIMUM_ATTEMPTS_REACHED" | |
| } | |
| }, | |
| { | |
| "eventId": "42", | |
| "eventTime": "2025-02-27T23:45:23.156652Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_TIMED_OUT", | |
| "taskId": "4208462", | |
| "activityTaskTimedOutEventAttributes": { | |
| "failure": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "cause": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| }, | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| }, | |
| "scheduledEventId": "13", | |
| "startedEventId": "35", | |
| "retryState": "RETRY_STATE_MAXIMUM_ATTEMPTS_REACHED" | |
| } | |
| }, | |
| { | |
| "eventId": "43", | |
| "eventTime": "2025-02-27T23:45:23.156658Z", | |
| "eventType": "EVENT_TYPE_ACTIVITY_TASK_TIMED_OUT", | |
| "taskId": "4208463", | |
| "activityTaskTimedOutEventAttributes": { | |
| "failure": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "cause": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| }, | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| }, | |
| "scheduledEventId": "10", | |
| "startedEventId": "36", | |
| "retryState": "RETRY_STATE_MAXIMUM_ATTEMPTS_REACHED" | |
| } | |
| }, | |
| { | |
| "eventId": "44", | |
| "eventTime": "2025-02-27T23:45:26.580581Z", | |
| "eventType": "EVENT_TYPE_WORKFLOW_TASK_SCHEDULED", | |
| "taskId": "4208464", | |
| "workflowTaskScheduledEventAttributes": { | |
| "taskQueue": { | |
| "name": "my-task-queue", | |
| "kind": "TASK_QUEUE_KIND_NORMAL" | |
| }, | |
| "startToCloseTimeout": "10s", | |
| "attempt": 1 | |
| } | |
| }, | |
| { | |
| "eventId": "45", | |
| "eventTime": "2025-02-27T23:45:26.590341Z", | |
| "eventType": "EVENT_TYPE_WORKFLOW_TASK_STARTED", | |
| "taskId": "4208467", | |
| "workflowTaskStartedEventAttributes": { | |
| "scheduledEventId": "44", | |
| "identity": "28513@Nishchiths-MacBook-Pro.local", | |
| "requestId": "642e6991-e2f5-4d6b-9b8b-3a6b3cb326a5", | |
| "historySizeBytes": "5649", | |
| "workerVersion": { | |
| "buildId": "b68844d9cb9e08974ca8fe86d492859e" | |
| } | |
| } | |
| }, | |
| { | |
| "eventId": "46", | |
| "eventTime": "2025-02-27T23:45:36.592895Z", | |
| "eventType": "EVENT_TYPE_WORKFLOW_TASK_TIMED_OUT", | |
| "taskId": "4208471", | |
| "workflowTaskTimedOutEventAttributes": { | |
| "scheduledEventId": "44", | |
| "startedEventId": "45", | |
| "timeoutType": "TIMEOUT_TYPE_START_TO_CLOSE" | |
| } | |
| }, | |
| { | |
| "eventId": "47", | |
| "eventTime": "2025-02-27T23:46:56.946218Z", | |
| "eventType": "EVENT_TYPE_WORKFLOW_TASK_SCHEDULED", | |
| "taskId": "4208491", | |
| "workflowTaskScheduledEventAttributes": { | |
| "taskQueue": { | |
| "name": "my-task-queue", | |
| "kind": "TASK_QUEUE_KIND_NORMAL" | |
| }, | |
| "startToCloseTimeout": "48.543967589s", | |
| "attempt": 7 | |
| } | |
| }, | |
| { | |
| "eventId": "48", | |
| "eventTime": "2025-02-27T23:46:56.954070Z", | |
| "eventType": "EVENT_TYPE_WORKFLOW_TASK_STARTED", | |
| "taskId": "4208492", | |
| "workflowTaskStartedEventAttributes": { | |
| "scheduledEventId": "47", | |
| "identity": "28513@Nishchiths-MacBook-Pro.local", | |
| "requestId": "eb1074da-b22f-4a45-80ad-643dfad66066", | |
| "historySizeBytes": "5825", | |
| "workerVersion": { | |
| "buildId": "b68844d9cb9e08974ca8fe86d492859e" | |
| } | |
| } | |
| }, | |
| { | |
| "eventId": "49", | |
| "eventTime": "2025-02-27T23:47:00.955005Z", | |
| "eventType": "EVENT_TYPE_WORKFLOW_TASK_COMPLETED", | |
| "taskId": "4208493", | |
| "workflowTaskCompletedEventAttributes": { | |
| "scheduledEventId": "47", | |
| "startedEventId": "48", | |
| "identity": "28513@Nishchiths-MacBook-Pro.local", | |
| "workerVersion": { | |
| "buildId": "b68844d9cb9e08974ca8fe86d492859e" | |
| }, | |
| "sdkMetadata": {}, | |
| "meteringMetadata": {} | |
| } | |
| }, | |
| { | |
| "eventId": "50", | |
| "eventTime": "2025-02-27T23:47:00.955151Z", | |
| "eventType": "EVENT_TYPE_WORKFLOW_EXECUTION_FAILED", | |
| "taskId": "4208494", | |
| "workflowExecutionFailedEventAttributes": { | |
| "failure": { | |
| "message": "Activity task timed out", | |
| "cause": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "cause": { | |
| "message": "activity Heartbeat timeout", | |
| "source": "Server", | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| }, | |
| "timeoutFailureInfo": { | |
| "timeoutType": "TIMEOUT_TYPE_HEARTBEAT" | |
| } | |
| }, | |
| "activityFailureInfo": { | |
| "scheduledEventId": "6", | |
| "startedEventId": "25", | |
| "activityType": { | |
| "name": "first_activity" | |
| }, | |
| "activityId": "2", | |
| "retryState": "RETRY_STATE_MAXIMUM_ATTEMPTS_REACHED" | |
| } | |
| }, | |
| "retryState": "RETRY_STATE_RETRY_POLICY_NOT_SET", | |
| "workflowTaskCompletedEventId": "49" | |
| } | |
| } | |
| ] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import asyncio | |
| import logging | |
| import threading | |
| from datetime import timedelta | |
| from temporalio import activity, workflow | |
| from temporalio.common import RetryPolicy | |
| from temporalio.client import Client | |
| from temporalio.worker import Worker | |
| from temporalio.worker.workflow_sandbox import ( | |
| SandboxedWorkflowRunner, | |
| SandboxRestrictions, | |
| ) | |
| from experiments.utils import auto_heartbeater | |
| class Activities: | |
| @staticmethod | |
| @activity.defn | |
| @auto_heartbeater | |
| async def first_activity(): | |
| """Makes multiple synchronous API calls""" | |
| import requests | |
| num_calls = 5 | |
| results = [] | |
| print(f"Making {num_calls} sequential API calls...") | |
| for i in range(num_calls): | |
| print(f"API call {i+1}/{num_calls}") | |
| try: | |
| # This public API has some latency which helps with our blocking example | |
| response = requests.get('https://jsonplaceholder.typicode.com/posts', timeout=5) | |
| results.append(response.json()) | |
| except Exception as e: | |
| print(f"Error in API call: {e}") | |
| results.append(None) | |
| print(f"Completed {len(results)} API calls") | |
| @workflow.defn | |
| class MyWorkflow: | |
| @workflow.run | |
| async def run(self) -> None: | |
| # Create multiple concurrent activity executions | |
| retry_policy = RetryPolicy( | |
| maximum_attempts=4, | |
| backoff_coefficient=2, | |
| ) | |
| activities = [ | |
| workflow.execute_activity_method( | |
| Activities.first_activity, | |
| schedule_to_close_timeout=timedelta(days=1), | |
| heartbeat_timeout=timedelta(seconds=10), | |
| retry_policy=retry_policy, | |
| ) | |
| for _ in range(10) | |
| ] | |
| # Wait for all activities to complete | |
| await asyncio.gather(*activities) | |
| async def create_worker(temporal_client: Client): | |
| worker = Worker( | |
| temporal_client, | |
| task_queue="my-task-queue", | |
| workflows=[MyWorkflow], | |
| activities=[Activities.first_activity], | |
| workflow_runner=SandboxedWorkflowRunner( | |
| restrictions=SandboxRestrictions.default.with_passthrough_modules( | |
| "application_sdk", "asyncio" | |
| ) | |
| ), | |
| ) | |
| await worker.run() | |
| async def main(): | |
| logging.basicConfig(level=logging.INFO) | |
| client = await Client.connect("localhost:7233") | |
| logging.info("Starting worker") | |
| worker_thread = threading.Thread( | |
| target=lambda: asyncio.run(create_worker(client)), daemon=True | |
| ) | |
| worker_thread.start() | |
| logging.info("Running workflow") | |
| await client.execute_workflow( | |
| MyWorkflow.run, | |
| id="my-workflow", | |
| task_queue="my-task-queue", | |
| ) | |
| print("Workflow completed") | |
| if __name__ == "__main__": | |
| asyncio.run(main()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment