Skip to content

Commit 91c0e16

Browse files
committed
chore: reformatted 3 files
1 parent 1a2ad02 commit 91c0e16

3 files changed

Lines changed: 53 additions & 15 deletions

File tree

emulator/src/aws_lambda_durable_functions_emulator/config.py

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,17 @@ def __post_init__(self):
5959

6060
def to_web_service_config(self):
6161
"""Convert to testing library web service config."""
62-
return WebServiceConfig(host=self.host, port=self.port, log_level=self.log_level)
62+
return WebServiceConfig(
63+
host=self.host, port=self.port, log_level=self.log_level
64+
)
6365

6466
def _validate_config(self):
6567
"""Validate all configuration parameters."""
6668

6769
# Validate Lambda endpoint URL
68-
def _raise_invalid_endpoint(endpoint: str, cause: Exception | None = None) -> None:
70+
def _raise_invalid_endpoint(
71+
endpoint: str, cause: Exception | None = None
72+
) -> None:
6973
msg = f"Invalid Lambda endpoint URL: {endpoint}"
7074
raise ValueError(msg) from cause
7175

@@ -79,11 +83,15 @@ def _raise_invalid_endpoint(endpoint: str, cause: Exception | None = None) -> No
7983
# Validate storage directory if specified
8084
if self.storage_dir:
8185

82-
def _raise_storage_error(storage_dir: str, cause: Exception | None = None) -> None:
86+
def _raise_storage_error(
87+
storage_dir: str, cause: Exception | None = None
88+
) -> None:
8389
msg = f"Storage directory is not writable: {storage_dir}"
8490
raise ValueError(msg) from cause
8591

86-
def _raise_access_error(storage_dir: str, cause: Exception | None = None) -> None:
92+
def _raise_access_error(
93+
storage_dir: str, cause: Exception | None = None
94+
) -> None:
8795
msg = f"Cannot access storage directory: {storage_dir}"
8896
raise ValueError(msg) from cause
8997

@@ -107,7 +115,13 @@ def _raise_access_error(storage_dir: str, cause: Exception | None = None) -> Non
107115
_raise_access_error(self.storage_dir, e)
108116

109117
# Validate log level
110-
valid_log_levels = [logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR, logging.CRITICAL]
118+
valid_log_levels = [
119+
logging.DEBUG,
120+
logging.INFO,
121+
logging.WARNING,
122+
logging.ERROR,
123+
logging.CRITICAL,
124+
]
111125
if self.log_level not in valid_log_levels:
112126
msg = f"Invalid log level: {self.log_level}. Must be one of {valid_log_levels}"
113127
raise ValueError(msg)

emulator/src/aws_lambda_durable_functions_emulator/factory.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77

88
import aws_durable_execution_sdk_python
99
import botocore.loaders
10-
from aws_durable_execution_sdk_python_testing.checkpoint.processor import CheckpointProcessor
10+
from aws_durable_execution_sdk_python_testing.checkpoint.processor import (
11+
CheckpointProcessor,
12+
)
1113
from aws_durable_execution_sdk_python_testing.executor import Executor
1214
from aws_durable_execution_sdk_python_testing.invoker import LambdaInvoker
1315
from aws_durable_execution_sdk_python_testing.scheduler import Scheduler
@@ -85,7 +87,9 @@ def create_executor(config: "EmulatorConfig"):
8587
store = TestingLibraryComponentFactory.create_store(config)
8688
scheduler = TestingLibraryComponentFactory.create_scheduler()
8789
invoker = TestingLibraryComponentFactory.create_invoker(config)
88-
checkpoint_processor = TestingLibraryComponentFactory.create_checkpoint_processor(store, scheduler)
90+
checkpoint_processor = (
91+
TestingLibraryComponentFactory.create_checkpoint_processor(store, scheduler)
92+
)
8993

9094
executor = Executor(store, scheduler, invoker, checkpoint_processor)
9195
checkpoint_processor.add_execution_observer(executor)

emulator/src/aws_lambda_durable_functions_emulator/server.py

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222

2323
# Configure logging
2424
log_level = get_log_level()
25-
logging.basicConfig(level=log_level, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
25+
logging.basicConfig(
26+
level=log_level, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s"
27+
)
2628
logger = logging.getLogger("durable_functions_emulator")
2729
logger.setLevel(log_level)
2830

@@ -66,7 +68,9 @@ def start(self):
6668
try:
6769
logger.info("Starting emulator server...")
6870
with self.web_server:
69-
logger.info("Server listening on %s:%s", self.config.host, self.config.port)
71+
logger.info(
72+
"Server listening on %s:%s", self.config.host, self.config.port
73+
)
7074
self.web_server.serve_forever()
7175
except KeyboardInterrupt:
7276
logger.info("Server shutdown requested by user")
@@ -79,17 +83,31 @@ def start(self):
7983

8084
def main():
8185
"""Main entry point for the emulator server."""
82-
parser = argparse.ArgumentParser(description="AWS Lambda Durable Functions Emulator (powered by testing library)")
83-
parser.add_argument("--host", type=str, help="Host to bind to (default: from HOST env var or 0.0.0.0)")
84-
parser.add_argument("--port", type=int, help="Port to bind to (default: from PORT env var or 5000)")
86+
parser = argparse.ArgumentParser(
87+
description="AWS Lambda Durable Functions Emulator (powered by testing library)"
88+
)
89+
parser.add_argument(
90+
"--host",
91+
type=str,
92+
help="Host to bind to (default: from HOST env var or 0.0.0.0)",
93+
)
94+
parser.add_argument(
95+
"--port", type=int, help="Port to bind to (default: from PORT env var or 5000)"
96+
)
8597
args = parser.parse_args()
8698

8799
try:
88100
# Create emulator configuration
89-
config = EmulatorConfig(host=args.host or get_host(), port=args.port or get_port())
101+
config = EmulatorConfig(
102+
host=args.host or get_host(), port=args.port or get_port()
103+
)
90104

91105
# Create and start emulator server
92-
logger.info("Starting AWS Lambda Durable Functions Emulator on %s:%s", config.host, config.port)
106+
logger.info(
107+
"Starting AWS Lambda Durable Functions Emulator on %s:%s",
108+
config.host,
109+
config.port,
110+
)
93111
server = EmulatorServer(config)
94112
server.start()
95113

@@ -105,7 +123,9 @@ def main():
105123

106124
except ImportError:
107125
logger.exception("Missing dependency")
108-
logger.info("Please install the aws-durable-execution-sdk-python-testing package:")
126+
logger.info(
127+
"Please install the aws-durable-execution-sdk-python-testing package:"
128+
)
109129
logger.info(" pip install aws-durable-execution-sdk-python-testing")
110130
sys.exit(1)
111131

0 commit comments

Comments
 (0)