Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/deploy-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ jobs:
env:
AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }}
LAMBDA_ENDPOINT: ${{ secrets.LAMBDA_ENDPOINT_BETA }}
INVOKE_ACCOUNT_ID: ${{ secrets.INVOKE_ACCOUNT_ID_BETA }}
KMS_KEY_ARN: ${{ secrets.KMS_KEY_ARN }}
run: |
# Build function name
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,7 @@ dist/
.idea
.env

.durable_executions

examples/build/*
examples/*.zip
29 changes: 4 additions & 25 deletions examples/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ def build_examples():

# Copy example functions
logger.info("Copying examples from %s", src_dir)
shutil.copytree(src_dir, build_dir / "src")
for file_path in src_dir.rglob("*"):
if file_path.is_file():
shutil.copy2(file_path, build_dir / file_path.name)

logger.info("Build completed successfully")
return True
Expand Down Expand Up @@ -296,13 +298,10 @@ def get_aws_config():
"region": os.getenv("AWS_REGION", "us-west-2"),
"lambda_endpoint": os.getenv("LAMBDA_ENDPOINT"),
"account_id": os.getenv("AWS_ACCOUNT_ID"),
"invoke_account_id": os.getenv("INVOKE_ACCOUNT_ID"),
"kms_key_arn": os.getenv("KMS_KEY_ARN"),
}

if not all(
[config["account_id"], config["lambda_endpoint"], config["invoke_account_id"]]
):
if not all([config["account_id"], config["lambda_endpoint"]]):
msg = "Missing required environment variables"
raise ValueError(msg)

Expand Down Expand Up @@ -406,26 +405,6 @@ def deploy_function(example_name: str, function_name: str | None = None):
except lambda_client.exceptions.ResourceNotFoundException:
lambda_client.create_function(**function_config, Code={"ZipFile": zip_content})

# Update invoke permission for worker account using put_resource_policy
function_arn = f"arn:aws:lambda:{config['region']}:{config['account_id']}:function:{function_name}"

policy_document = {
"Version": "2012-10-17",
"Statement": [
{
"Sid": "dex-invoke-permission",
"Effect": "Allow",
"Principal": {"AWS": config["invoke_account_id"]},
"Action": "lambda:InvokeFunction",
"Resource": f"{function_arn}:*",
}
],
}

lambda_client.put_resource_policy(
ResourceArn=function_arn, Policy=json.dumps(policy_document)
)

logger.info("Function deployed successfully! %s", function_name)
return True

Expand Down
26 changes: 13 additions & 13 deletions examples/examples-catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"RetentionPeriodInDays": 7,
"ExecutionTimeout": 300
},
"path": "./src/step.py"
"path": "./src/step/step.py"
},
{
"name": "Step with Name",
Expand All @@ -32,7 +32,7 @@
"RetentionPeriodInDays": 7,
"ExecutionTimeout": 300
},
"path": "./src/step_with_name.py"
"path": "./src/step/step_with_name.py"
},
{
"name": "Step with Retry",
Expand All @@ -43,7 +43,7 @@
"RetentionPeriodInDays": 7,
"ExecutionTimeout": 300
},
"path": "./src/step_with_retry.py"
"path": "./src/step/step_with_retry.py"
},
{
"name": "Wait State",
Expand All @@ -54,7 +54,7 @@
"RetentionPeriodInDays": 7,
"ExecutionTimeout": 300
},
"path": "./src/wait.py"
"path": "./src/wait/wait.py"
},
{
"name": "Callback",
Expand All @@ -65,7 +65,7 @@
"RetentionPeriodInDays": 7,
"ExecutionTimeout": 300
},
"path": "./src/callback.py"
"path": "./src/callback/callback.py"
},
{
"name": "Wait for Callback",
Expand All @@ -76,7 +76,7 @@
"RetentionPeriodInDays": 7,
"ExecutionTimeout": 300
},
"path": "./src/wait_for_callback.py"
"path": "./src/wait_for_callback/wait_for_callback.py"
},
{
"name": "Run in Child Context",
Expand All @@ -87,7 +87,7 @@
"RetentionPeriodInDays": 7,
"ExecutionTimeout": 300
},
"path": "./src/run_in_child_context.py"
"path": "./src/run_in_child_context/run_in_child_context.py"
},
{
"name": "Parallel Operations",
Expand All @@ -98,7 +98,7 @@
"RetentionPeriodInDays": 7,
"ExecutionTimeout": 300
},
"path": "./src/parallel.py"
"path": "./src/parallel/parallel.py"
},
{
"name": "Map Operations",
Expand All @@ -109,7 +109,7 @@
"RetentionPeriodInDays": 7,
"ExecutionTimeout": 300
},
"path": "./src/map_operations.py"
"path": "./src/map/map_operations.py"
},
{
"name": "Block Example",
Expand All @@ -120,7 +120,7 @@
"RetentionPeriodInDays": 7,
"ExecutionTimeout": 300
},
"path": "./src/block_example.py"
"path": "./src/block_example/block_example.py"
},
{
"name": "Logger Example",
Expand All @@ -131,7 +131,7 @@
"RetentionPeriodInDays": 7,
"ExecutionTimeout": 300
},
"path": "./src/logger_example.py"
"path": "./src/logger_example/logger_example.py"
},
{
"name": "Steps with Retry",
Expand All @@ -142,7 +142,7 @@
"RetentionPeriodInDays": 7,
"ExecutionTimeout": 300
},
"path": "./src/steps_with_retry.py"
"path": "./src/step/steps_with_retry.py"
},
{
"name": "Wait for Condition",
Expand All @@ -153,7 +153,7 @@
"RetentionPeriodInDays": 7,
"ExecutionTimeout": 300
},
"path": "./src/wait_for_condition.py"
"path": "./src/wait_for_condition/wait_for_condition.py"
}
]
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest
from aws_durable_execution_sdk_python.execution import InvocationStatus

from src import block_example
from src.block_example import block_example
from test.conftest import deserialize_operation_payload


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest
from aws_durable_execution_sdk_python.execution import InvocationStatus

from src import callback
from src.callback import callback
from test.conftest import deserialize_operation_payload


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest
from aws_durable_execution_sdk_python.execution import InvocationStatus

from src import callback_with_timeout
from src.callback import callback_with_timeout
from test.conftest import deserialize_operation_payload


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from aws_durable_execution_sdk_python.execution import InvocationStatus
from aws_durable_execution_sdk_python.lambda_service import OperationType

from src import logger_example
from src.logger_example import logger_example
from test.conftest import deserialize_operation_payload


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from aws_durable_execution_sdk_python.execution import InvocationStatus
from aws_durable_execution_sdk_python.lambda_service import OperationType

from src import map_operations
from src.map import map_operations
from test.conftest import deserialize_operation_payload


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from aws_durable_execution_sdk_python.execution import InvocationStatus
from aws_durable_execution_sdk_python.lambda_service import OperationType

from src import parallel
from src.parallel import parallel
from test.conftest import deserialize_operation_payload


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest
from aws_durable_execution_sdk_python.execution import InvocationStatus

from src import run_in_child_context
from src.run_in_child_context import run_in_child_context
from test.conftest import deserialize_operation_payload


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest
from aws_durable_execution_sdk_python.execution import InvocationStatus

from src import step
from src.step import step
from test.conftest import deserialize_operation_payload


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from aws_durable_execution_sdk_python.execution import InvocationStatus
from aws_durable_execution_sdk_python.lambda_service import OperationType

from src import step_no_name, step_with_exponential_backoff, step_with_name
from src.step import step_no_name, step_with_exponential_backoff, step_with_name
from test.conftest import deserialize_operation_payload


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from aws_durable_execution_sdk_python.execution import InvocationStatus
from aws_durable_execution_sdk_python.lambda_service import OperationType

from src import step_semantics_at_most_once
from src.step import step_semantics_at_most_once
from test.conftest import deserialize_operation_payload


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from aws_durable_execution_sdk_python.execution import InvocationStatus
from aws_durable_execution_sdk_python.lambda_service import OperationType

from src import step_with_retry
from src.step import step_with_retry
from test.conftest import deserialize_operation_payload


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from aws_durable_execution_sdk_python.execution import InvocationStatus
from aws_durable_execution_sdk_python.lambda_service import OperationType

from src import steps_with_retry
from src.step import steps_with_retry
from test.conftest import deserialize_operation_payload


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest
from aws_durable_execution_sdk_python.execution import InvocationStatus

from src import wait
from src.wait import wait
from test.conftest import deserialize_operation_payload


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest
from aws_durable_execution_sdk_python.execution import InvocationStatus

from src import wait_with_name
from src.wait import wait_with_name
from test.conftest import deserialize_operation_payload


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from aws_durable_execution_sdk_python.execution import InvocationStatus
from aws_durable_execution_sdk_python.lambda_service import OperationType

from src import wait_for_condition
from src.wait_for_condition import wait_for_condition
from test.conftest import deserialize_operation_payload


Expand Down