-
Notifications
You must be signed in to change notification settings - Fork 23
feat(plugin): decouple instrumentation enums from lambda service #634
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
fe50333
0a0f9a6
c7c4c09
51aae61
007eb1c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,12 +15,12 @@ | |
| from aws_durable_execution_sdk_python.lambda_service import ( | ||
| DurableExecutionInvocationOutput, | ||
| ErrorObject, | ||
| InvocationStatus, | ||
| InvocationStatus as ServiceInvocationStatus, | ||
| Operation, | ||
| OperationAction, | ||
| OperationStatus, | ||
| OperationSubType, | ||
| OperationType, | ||
| OperationType as ServiceOperationType, | ||
| OperationUpdate, | ||
| ) | ||
| from aws_durable_execution_sdk_python.types import LambdaContext | ||
|
|
@@ -31,6 +31,34 @@ | |
| DURABLE_INSTRUMENTATION_PLUGIN_API_VERSION = 1 | ||
|
|
||
|
|
||
| class InvocationStatus(Enum): | ||
This comment was marked as outdated.
Sorry, something went wrong.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codex AI review [P1] Version this enum identity change as a new plugin API. Existing API-v1 providers remain accepted, but they compare hook values against |
||
| """Invocation outcomes exposed to instrumentation plugins.""" | ||
|
|
||
| SUCCEEDED = "SUCCEEDED" | ||
| FAILED = "FAILED" | ||
| PENDING = "PENDING" | ||
| RETRY = "RETRY" | ||
|
|
||
|
|
||
| class OperationType(Enum): | ||
|
zhongkechen marked this conversation as resolved.
|
||
| """Durable operation categories exposed to instrumentation plugins.""" | ||
|
|
||
| EXECUTION = "EXECUTION" | ||
| CONTEXT = "CONTEXT" | ||
| STEP = "STEP" | ||
| WAIT = "WAIT" | ||
| CALLBACK = "CALLBACK" | ||
| CHAINED_INVOKE = "CHAINED_INVOKE" | ||
|
|
||
|
|
||
| def _to_invocation_status(status: ServiceInvocationStatus) -> InvocationStatus: | ||
| return InvocationStatus(status.value) | ||
|
|
||
|
|
||
| def _to_operation_type(operation_type: ServiceOperationType) -> OperationType: | ||
| return OperationType(operation_type.value) | ||
|
|
||
|
|
||
| def _extract_result(operation: Operation) -> str | None: | ||
| if operation.step_details and operation.step_details.result is not None: | ||
| return operation.step_details.result | ||
|
|
@@ -91,7 +119,7 @@ def from_operation( | |
| ) -> OperationInfo: | ||
| return OperationInfo( | ||
| operation_id=operation.operation_id, | ||
| operation_type=operation.operation_type, | ||
| operation_type=_to_operation_type(operation.operation_type), | ||
| sub_type=operation.sub_type, | ||
| name=operation.name, | ||
| parent_id=operation.parent_id, | ||
|
|
@@ -338,7 +366,7 @@ def from_durable_execution_invocation_output( | |
| if operations is not None | ||
| else invocation_start_info.operations | ||
| ), | ||
| status=output.status, | ||
| status=_to_invocation_status(output.status), | ||
| error=output.error, | ||
| execution_result=output.result, | ||
| ) | ||
|
|
@@ -609,7 +637,7 @@ def on_user_function_start( | |
| """Execute any registered plugins for the operation when its user function starts to execute.""" | ||
| start_info = UserFunctionStartInfo( | ||
| operation_id=operation_identifier.operation_id, | ||
| operation_type=operation_identifier.type, | ||
| operation_type=_to_operation_type(operation_identifier.type), | ||
| sub_type=operation_identifier.sub_type, | ||
| name=operation_identifier.name, | ||
| parent_id=operation_identifier.parent_id, | ||
|
|
@@ -647,7 +675,7 @@ def on_operation_action( | |
| self.execute_plugins( | ||
| OperationStartInfo( | ||
| operation_id=update.operation_id, | ||
| operation_type=update.operation_type, | ||
| operation_type=_to_operation_type(update.operation_type), | ||
| sub_type=update.sub_type, | ||
| name=update.name, | ||
| parent_id=update.parent_id, | ||
|
|
@@ -665,7 +693,7 @@ def on_operation_replay(self, operation: Operation) -> None: | |
|
|
||
| start_info = OperationStartInfo( | ||
| operation_id=operation.operation_id, | ||
| operation_type=operation.operation_type, | ||
| operation_type=_to_operation_type(operation.operation_type), | ||
| sub_type=operation.sub_type, | ||
| name=operation.name, | ||
| parent_id=operation.parent_id, | ||
|
|
@@ -688,7 +716,7 @@ def on_child_context_end( | |
| self.execute_plugins( | ||
| OperationEndInfo( | ||
| operation_id=operation_identifier.operation_id, | ||
| operation_type=operation_identifier.type, | ||
| operation_type=_to_operation_type(operation_identifier.type), | ||
| sub_type=operation_identifier.sub_type, | ||
| name=operation_identifier.name, | ||
| parent_id=operation_identifier.parent_id, | ||
|
|
@@ -732,7 +760,7 @@ def on_operation_update( | |
| self.execute_plugins( | ||
| OperationEndInfo( | ||
| operation_id=operation.operation_id, | ||
| operation_type=operation.operation_type, | ||
| operation_type=_to_operation_type(operation.operation_type), | ||
| sub_type=operation.sub_type, | ||
| name=operation.name, | ||
| parent_id=operation.parent_id, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.