async-lambda-unstable 0.2.10__tar.gz → 0.2.12__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/PKG-INFO +4 -3
  2. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/README.md +3 -2
  3. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/async_lambda/__init__.py +1 -1
  4. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/async_lambda/build_config.py +4 -4
  5. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/async_lambda/models/task.py +11 -1
  6. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/async_lambda_unstable.egg-info/PKG-INFO +4 -3
  7. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/async_lambda/cli.py +0 -0
  8. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/async_lambda/config.py +0 -0
  9. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/async_lambda/controller.py +0 -0
  10. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/async_lambda/env.py +0 -0
  11. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/async_lambda/models/__init__.py +0 -0
  12. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/async_lambda/models/events/__init__.py +0 -0
  13. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/async_lambda/models/events/api_event.py +0 -0
  14. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/async_lambda/models/events/base_event.py +0 -0
  15. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/async_lambda/models/events/managed_sqs_event.py +0 -0
  16. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/async_lambda/models/events/scheduled_event.py +0 -0
  17. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/async_lambda/models/events/unmanaged_sqs_event.py +0 -0
  18. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/async_lambda/models/mock/mock_context.py +0 -0
  19. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/async_lambda/models/mock/mock_event.py +0 -0
  20. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/async_lambda/py.typed +0 -0
  21. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/async_lambda_unstable.egg-info/SOURCES.txt +0 -0
  22. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/async_lambda_unstable.egg-info/dependency_links.txt +0 -0
  23. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/async_lambda_unstable.egg-info/entry_points.txt +0 -0
  24. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/async_lambda_unstable.egg-info/requires.txt +0 -0
  25. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/async_lambda_unstable.egg-info/top_level.txt +0 -0
  26. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/pyproject.toml +0 -0
  27. {async-lambda-unstable-0.2.10 → async-lambda-unstable-0.2.12}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: async-lambda-unstable
3
- Version: 0.2.10
3
+ Version: 0.2.12
4
4
  Summary: A framework for creating AWS Lambda Async Workflows. - Unstable Branch
5
5
  Author-email: "Nuclei, Inc" <engineering@nuclei.ai>
6
6
  Description-Content-Type: text/markdown
@@ -46,6 +46,7 @@ All task decorators share common arguments for configuring the underlying lambda
46
46
  - `memory: int = 128` Sets the memory allocation for the function.
47
47
  - `timeout: int = 60` Sets the timeout for the function (max 900 seconds).
48
48
  - `ephemeral_storage: int = 512` Sets the ephemeral storage allocation for the function.
49
+ - `maximum_concurrency: Optional[int] = None` Sets the maximum concurrency value for the SQS trigger for the function. (only applies to `async_task` and `sqs_task` tasks.)
49
50
 
50
51
  ## Async Task
51
52
 
@@ -172,11 +173,11 @@ These environment variables will also be available during build time.
172
173
 
173
174
  [The value is passed to the `Environment` property on `SAM::Serverless::Function`](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html#sam-function-environment)
174
175
 
175
- ## `policy_arns`
176
+ ## `policies`
176
177
 
177
178
  ```
178
179
  [
179
- 'IAM_POLICY_ARN'
180
+ 'IAM_POLICY_ARN' | STATEMENT
180
181
  ]
181
182
  ```
182
183
 
@@ -39,6 +39,7 @@ All task decorators share common arguments for configuring the underlying lambda
39
39
  - `memory: int = 128` Sets the memory allocation for the function.
40
40
  - `timeout: int = 60` Sets the timeout for the function (max 900 seconds).
41
41
  - `ephemeral_storage: int = 512` Sets the ephemeral storage allocation for the function.
42
+ - `maximum_concurrency: Optional[int] = None` Sets the maximum concurrency value for the SQS trigger for the function. (only applies to `async_task` and `sqs_task` tasks.)
42
43
 
43
44
  ## Async Task
44
45
 
@@ -165,11 +166,11 @@ These environment variables will also be available during build time.
165
166
 
166
167
  [The value is passed to the `Environment` property on `SAM::Serverless::Function`](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html#sam-function-environment)
167
168
 
168
- ## `policy_arns`
169
+ ## `policies`
169
170
 
170
171
  ```
171
172
  [
172
- 'IAM_POLICY_ARN'
173
+ 'IAM_POLICY_ARN' | STATEMENT
173
174
  ]
174
175
  ```
175
176
 
@@ -9,4 +9,4 @@ from .models.events.managed_sqs_event import ManagedSQSEvent as ManagedSQSEvent
9
9
  from .models.events.scheduled_event import ScheduledEvent as ScheduledEvent
10
10
  from .models.events.unmanaged_sqs_event import UnmanagedSQSEvent as UnmanagedSQSEvent
11
11
 
12
- __version__ = "0.2.10"
12
+ __version__ = "0.2.12"
@@ -1,11 +1,11 @@
1
1
  from dataclasses import dataclass
2
- from typing import Dict, List, Optional, Set
2
+ from typing import Dict, List, Optional, Set, Union
3
3
 
4
4
 
5
5
  @dataclass
6
6
  class AsyncLambdaBuildConfig:
7
7
  environment_variables: Dict[str, str]
8
- policy_arns: Set[str]
8
+ policies: List[Union[str, dict]]
9
9
  layers: List[str]
10
10
  subnet_ids: Set[str]
11
11
  security_group_ids: Set[str]
@@ -17,7 +17,7 @@ class AsyncLambdaBuildConfig:
17
17
  @classmethod
18
18
  def new(cls, config: dict) -> "AsyncLambdaBuildConfig":
19
19
  return cls(
20
- policy_arns=set(config.get("policy_arns", set())),
20
+ policies=list(config.get("policies", list())),
21
21
  environment_variables=config.get("environment_variables", dict()),
22
22
  layers=list(config.get("layers", list())),
23
23
  subnet_ids=set(config.get("subnet_ids", set())),
@@ -29,7 +29,7 @@ class AsyncLambdaBuildConfig:
29
29
  )
30
30
 
31
31
  def merge(self, other: "AsyncLambdaBuildConfig"):
32
- self.policy_arns.update(other.policy_arns)
32
+ self.policies += other.policies
33
33
  self.environment_variables.update(other.environment_variables)
34
34
  self.layers = list(dict.fromkeys(self.layers + other.layers))
35
35
  self.subnet_ids.update(other.subnet_ids)
@@ -31,6 +31,7 @@ class AsyncLambdaTask(Generic[EventType]):
31
31
  timeout: int
32
32
  memory: int
33
33
  ephemeral_storage: int
34
+ maximum_concurrency: Optional[int]
34
35
 
35
36
  executable: Callable[[EventType], Any]
36
37
 
@@ -43,6 +44,7 @@ class AsyncLambdaTask(Generic[EventType]):
43
44
  timeout: int = 60,
44
45
  memory: int = 128,
45
46
  ephemeral_storage: int = 512,
47
+ maximum_concurrency: Optional[int] = None,
46
48
  ):
47
49
  AsyncLambdaTask.validate_task_id(task_id)
48
50
  self.executable = executable
@@ -52,6 +54,7 @@ class AsyncLambdaTask(Generic[EventType]):
52
54
  self.timeout = timeout
53
55
  self.memory = memory
54
56
  self.ephemeral_storage = ephemeral_storage
57
+ self.maximum_concurrency = maximum_concurrency
55
58
 
56
59
  @staticmethod
57
60
  def validate_task_id(task_id: str):
@@ -93,6 +96,11 @@ class AsyncLambdaTask(Generic[EventType]):
93
96
  return f"{self.get_function_logical_id()}Extra{index}"
94
97
 
95
98
  def get_template_events(self):
99
+ sqs_properties = {}
100
+ if self.maximum_concurrency is not None:
101
+ sqs_properties["ScalingConfig"] = {
102
+ "MaximumConcurrency": self.maximum_concurrency
103
+ }
96
104
  if self.trigger_type == TaskTriggerType.MANAGED_SQS:
97
105
  return {
98
106
  "ManagedSQS": {
@@ -106,6 +114,7 @@ class AsyncLambdaTask(Generic[EventType]):
106
114
  "Arn",
107
115
  ]
108
116
  },
117
+ **sqs_properties,
109
118
  },
110
119
  }
111
120
  }
@@ -117,6 +126,7 @@ class AsyncLambdaTask(Generic[EventType]):
117
126
  "BatchSize": 1,
118
127
  "Enabled": True,
119
128
  "Queue": self.trigger_config["queue_arn"],
129
+ **sqs_properties,
120
130
  },
121
131
  }
122
132
  }
@@ -257,7 +267,7 @@ class AsyncLambdaTask(Generic[EventType]):
257
267
  "Events": events,
258
268
  "Policies": [
259
269
  {"Statement": policy_statements},
260
- *build_config.policy_arns,
270
+ *build_config.policies,
261
271
  ],
262
272
  **function_properties,
263
273
  },
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: async-lambda-unstable
3
- Version: 0.2.10
3
+ Version: 0.2.12
4
4
  Summary: A framework for creating AWS Lambda Async Workflows. - Unstable Branch
5
5
  Author-email: "Nuclei, Inc" <engineering@nuclei.ai>
6
6
  Description-Content-Type: text/markdown
@@ -46,6 +46,7 @@ All task decorators share common arguments for configuring the underlying lambda
46
46
  - `memory: int = 128` Sets the memory allocation for the function.
47
47
  - `timeout: int = 60` Sets the timeout for the function (max 900 seconds).
48
48
  - `ephemeral_storage: int = 512` Sets the ephemeral storage allocation for the function.
49
+ - `maximum_concurrency: Optional[int] = None` Sets the maximum concurrency value for the SQS trigger for the function. (only applies to `async_task` and `sqs_task` tasks.)
49
50
 
50
51
  ## Async Task
51
52
 
@@ -172,11 +173,11 @@ These environment variables will also be available during build time.
172
173
 
173
174
  [The value is passed to the `Environment` property on `SAM::Serverless::Function`](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html#sam-function-environment)
174
175
 
175
- ## `policy_arns`
176
+ ## `policies`
176
177
 
177
178
  ```
178
179
  [
179
- 'IAM_POLICY_ARN'
180
+ 'IAM_POLICY_ARN' | STATEMENT
180
181
  ]
181
182
  ```
182
183