|
38 | 38 | from typing_extensions import Literal, Protocol, runtime_checkable |
39 | 39 |
|
40 | 40 | import temporalio.worker |
| 41 | +import temporalio.workflow |
41 | 42 | from temporalio import activity, workflow |
42 | 43 | from temporalio.api.common.v1 import Payload, Payloads, WorkflowExecution |
43 | 44 | from temporalio.api.enums.v1 import EventType |
@@ -5040,61 +5041,58 @@ async def run_scenario( |
5040 | 5041 | update_scenario=scenario, |
5041 | 5042 | ) |
5042 | 5043 |
|
5043 | | - # Run all tasks concurrently |
5044 | | - await asyncio.gather( |
5045 | 5044 | # When unconfigured completely, confirm task fails as normal |
5046 | | - run_scenario( |
| 5045 | + await run_scenario( |
5047 | 5046 | FailureTypesUnconfiguredWorkflow, |
5048 | 5047 | FailureTypesScenario.THROW_CUSTOM_EXCEPTION, |
5049 | 5048 | expect_task_fail=True, |
5050 | | - ), |
5051 | | - run_scenario( |
| 5049 | + ) |
| 5050 | + await run_scenario( |
5052 | 5051 | FailureTypesUnconfiguredWorkflow, |
5053 | 5052 | FailureTypesScenario.CAUSE_NON_DETERMINISM, |
5054 | 5053 | expect_task_fail=True, |
5055 | | - ), |
| 5054 | + ) |
5056 | 5055 | # When configured at the worker level explicitly, confirm not task fail |
5057 | 5056 | # but rather expected exceptions |
5058 | | - run_scenario( |
| 5057 | + await run_scenario( |
5059 | 5058 | FailureTypesUnconfiguredWorkflow, |
5060 | 5059 | FailureTypesScenario.THROW_CUSTOM_EXCEPTION, |
5061 | 5060 | worker_level_failure_exception_type=FailureTypesCustomException, |
5062 | | - ), |
5063 | | - run_scenario( |
| 5061 | + ) |
| 5062 | + await run_scenario( |
5064 | 5063 | FailureTypesUnconfiguredWorkflow, |
5065 | 5064 | FailureTypesScenario.CAUSE_NON_DETERMINISM, |
5066 | | - worker_level_failure_exception_type=workflow.NondeterminismError, |
5067 | | - ), |
| 5065 | + worker_level_failure_exception_type=temporalio.workflow.NondeterminismError, |
| 5066 | + ) |
5068 | 5067 | # When configured at the worker level inherited |
5069 | | - run_scenario( |
| 5068 | + await run_scenario( |
5070 | 5069 | FailureTypesUnconfiguredWorkflow, |
5071 | 5070 | FailureTypesScenario.THROW_CUSTOM_EXCEPTION, |
5072 | 5071 | worker_level_failure_exception_type=Exception, |
5073 | | - ), |
5074 | | - run_scenario( |
| 5072 | + ) |
| 5073 | + await run_scenario( |
5075 | 5074 | FailureTypesUnconfiguredWorkflow, |
5076 | 5075 | FailureTypesScenario.CAUSE_NON_DETERMINISM, |
5077 | 5076 | worker_level_failure_exception_type=Exception, |
5078 | | - ), |
| 5077 | + ) |
5079 | 5078 | # When configured at the workflow level explicitly |
5080 | | - run_scenario( |
| 5079 | + await run_scenario( |
5081 | 5080 | FailureTypesConfiguredExplicitlyWorkflow, |
5082 | 5081 | FailureTypesScenario.THROW_CUSTOM_EXCEPTION, |
5083 | | - ), |
5084 | | - run_scenario( |
| 5082 | + ) |
| 5083 | + await run_scenario( |
5085 | 5084 | FailureTypesConfiguredExplicitlyWorkflow, |
5086 | 5085 | FailureTypesScenario.CAUSE_NON_DETERMINISM, |
5087 | | - ), |
| 5086 | + ) |
5088 | 5087 | # When configured at the workflow level inherited |
5089 | | - run_scenario( |
| 5088 | + await run_scenario( |
5090 | 5089 | FailureTypesConfiguredInheritedWorkflow, |
5091 | 5090 | FailureTypesScenario.THROW_CUSTOM_EXCEPTION, |
5092 | | - ), |
5093 | | - run_scenario( |
| 5091 | + ) |
| 5092 | + await run_scenario( |
5094 | 5093 | FailureTypesConfiguredInheritedWorkflow, |
5095 | 5094 | FailureTypesScenario.CAUSE_NON_DETERMINISM, |
5096 | | - ), |
5097 | | - ) |
| 5095 | + ) |
5098 | 5096 |
|
5099 | 5097 |
|
5100 | 5098 | @workflow.defn(failure_exception_types=[Exception]) |
|
0 commit comments