async-lambda-unstable 0.5.4__tar.gz → 0.5.6__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 (36) hide show
  1. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/PKG-INFO +1 -1
  2. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/__init__.py +2 -1
  3. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/config.py +5 -0
  4. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/controller.py +66 -4
  5. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/models/task.py +5 -3
  6. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda_unstable.egg-info/PKG-INFO +1 -1
  7. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/README.md +0 -0
  8. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/build_config.py +0 -0
  9. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/cli.py +0 -0
  10. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/client.py +0 -0
  11. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/defer.py +0 -0
  12. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/env.py +0 -0
  13. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/middleware.py +0 -0
  14. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/models/__init__.py +0 -0
  15. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/models/api_response.py +0 -0
  16. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/models/case_insensitive_dict.py +0 -0
  17. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/models/events/__init__.py +0 -0
  18. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/models/events/api_event.py +0 -0
  19. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/models/events/base_event.py +0 -0
  20. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/models/events/dynamodb_event.py +0 -0
  21. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/models/events/managed_sqs_batch_event.py +0 -0
  22. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/models/events/managed_sqs_event.py +0 -0
  23. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/models/events/scheduled_event.py +0 -0
  24. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/models/events/unmanaged_sqs_event.py +0 -0
  25. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/models/mock/mock_context.py +0 -0
  26. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/models/mock/mock_event.py +0 -0
  27. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/payload_encoder.py +0 -0
  28. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/py.typed +0 -0
  29. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda/util.py +0 -0
  30. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda_unstable.egg-info/SOURCES.txt +0 -0
  31. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda_unstable.egg-info/dependency_links.txt +0 -0
  32. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda_unstable.egg-info/entry_points.txt +0 -0
  33. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda_unstable.egg-info/requires.txt +0 -0
  34. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/async_lambda_unstable.egg-info/top_level.txt +0 -0
  35. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/pyproject.toml +0 -0
  36. {async-lambda-unstable-0.5.4 → async-lambda-unstable-0.5.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: async-lambda-unstable
3
- Version: 0.5.4
3
+ Version: 0.5.6
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
@@ -1,3 +1,4 @@
1
+ from .config import config_set_default_task_memory as config_set_default_task_memory
1
2
  from .config import config_set_name as config_set_name
2
3
  from .config import config_set_runtime as config_set_runtime
3
4
  from .config import config_set_s3_payload_retention as config_set_s3_payload_retention
@@ -20,4 +21,4 @@ from .models.events.managed_sqs_event import ManagedSQSEvent as ManagedSQSEvent
20
21
  from .models.events.scheduled_event import ScheduledEvent as ScheduledEvent
21
22
  from .models.events.unmanaged_sqs_event import UnmanagedSQSEvent as UnmanagedSQSEvent
22
23
 
23
- __version__ = "0.5.4"
24
+ __version__ = "0.5.6"
@@ -5,6 +5,7 @@ class AsyncLambdaConfig:
5
5
  name: str = "async-lambda"
6
6
  runtime: str = "python3.10"
7
7
  s3_payload_retention: Optional[int] = 30
8
+ default_task_memory: int = 128
8
9
 
9
10
 
10
11
  config = AsyncLambdaConfig()
@@ -29,3 +30,7 @@ def config_set_s3_payload_retention(days: Optional[int]):
29
30
  Sets the s3_payload_retention policy in days.
30
31
  """
31
32
  config.s3_payload_retention = days
33
+
34
+
35
+ def config_set_default_task_memory(memory: int = 128):
36
+ config.default_task_memory = memory
@@ -713,6 +713,9 @@ class AsyncLambdaController:
713
713
  is_dlq_task: bool = False,
714
714
  lane_count: Optional[int] = None,
715
715
  propagate_lane_assignment: Optional[bool] = None,
716
+ timeout: int = 60,
717
+ memory: Optional[int] = None,
718
+ ephemeral_storage: int = 512,
716
719
  **kwargs,
717
720
  ):
718
721
  """
@@ -742,6 +745,9 @@ class AsyncLambdaController:
742
745
  "propagate_lane_assignment": propagate_lane_assignment,
743
746
  "batch_size": 1,
744
747
  },
748
+ timeout=timeout,
749
+ memory=memory,
750
+ ephemeral_storage=ephemeral_storage,
745
751
  **kwargs,
746
752
  )
747
753
  )
@@ -759,6 +765,9 @@ class AsyncLambdaController:
759
765
  propagate_lane_assignment: Optional[bool] = None,
760
766
  batch_size: int = 20,
761
767
  max_batching_window: Optional[int] = None,
768
+ timeout: int = 60,
769
+ memory: Optional[int] = None,
770
+ ephemeral_storage: int = 512,
762
771
  **kwargs,
763
772
  ):
764
773
  """
@@ -789,6 +798,9 @@ class AsyncLambdaController:
789
798
  "batch_size": batch_size,
790
799
  "max_batching_window": max_batching_window,
791
800
  },
801
+ timeout=timeout,
802
+ memory=memory,
803
+ ephemeral_storage=ephemeral_storage,
792
804
  **kwargs,
793
805
  )
794
806
  )
@@ -796,7 +808,15 @@ class AsyncLambdaController:
796
808
 
797
809
  return _task
798
810
 
799
- def sqs_task(self, task_id: str, queue_arn: str, **kwargs):
811
+ def sqs_task(
812
+ self,
813
+ task_id: str,
814
+ queue_arn: str,
815
+ timeout: int = 60,
816
+ memory: Optional[int] = None,
817
+ ephemeral_storage: int = 512,
818
+ **kwargs,
819
+ ):
800
820
  """
801
821
  Decorate a function to register it as an SQS task.
802
822
  These tasks will be triggered by messages in the given queue.
@@ -818,6 +838,9 @@ class AsyncLambdaController:
818
838
  task_id=task_id,
819
839
  trigger_type=TaskTriggerType.UNMANAGED_SQS,
820
840
  trigger_config={"queue_arn": queue_arn},
841
+ timeout=timeout,
842
+ memory=memory,
843
+ ephemeral_storage=ephemeral_storage,
821
844
  **kwargs,
822
845
  )
823
846
  )
@@ -826,7 +849,15 @@ class AsyncLambdaController:
826
849
 
827
850
  return _task
828
851
 
829
- def scheduled_task(self, task_id: str, schedule_expression: str, **kwargs):
852
+ def scheduled_task(
853
+ self,
854
+ task_id: str,
855
+ schedule_expression: str,
856
+ timeout: int = 60,
857
+ memory: Optional[int] = None,
858
+ ephemeral_storage: int = 512,
859
+ **kwargs,
860
+ ):
830
861
  """
831
862
  Decorate a function to register it as a scheduled task.
832
863
  These tasks will be triggered by the given schedule expression.
@@ -848,6 +879,9 @@ class AsyncLambdaController:
848
879
  task_id=task_id,
849
880
  trigger_type=TaskTriggerType.SCHEDULED_EVENT,
850
881
  trigger_config={"schedule_expression": schedule_expression},
882
+ timeout=timeout,
883
+ memory=memory,
884
+ ephemeral_storage=ephemeral_storage,
851
885
  **kwargs,
852
886
  )
853
887
  )
@@ -856,7 +890,16 @@ class AsyncLambdaController:
856
890
 
857
891
  return _task
858
892
 
859
- def api_task(self, task_id: str, path: str, method: str, **kwargs):
893
+ def api_task(
894
+ self,
895
+ task_id: str,
896
+ path: str,
897
+ method: str,
898
+ timeout: int = 60,
899
+ memory: Optional[int] = None,
900
+ ephemeral_storage: int = 512,
901
+ **kwargs,
902
+ ):
860
903
  """
861
904
  Decorate a function to register it as an API task.
862
905
  These tasks will be triggered by an API call.
@@ -878,6 +921,9 @@ class AsyncLambdaController:
878
921
  task_id=task_id,
879
922
  trigger_type=TaskTriggerType.API_EVENT,
880
923
  trigger_config={"path": path, "method": method},
924
+ timeout=timeout,
925
+ memory=memory,
926
+ ephemeral_storage=ephemeral_storage,
881
927
  **kwargs,
882
928
  )
883
929
  )
@@ -893,6 +939,9 @@ class AsyncLambdaController:
893
939
  stream_arn: str,
894
940
  batch_size: int,
895
941
  max_batching_window: int = 0,
942
+ timeout: int = 60,
943
+ memory: Optional[int] = None,
944
+ ephemeral_storage: int = 512,
896
945
  **kwargs,
897
946
  ):
898
947
  """
@@ -920,6 +969,9 @@ class AsyncLambdaController:
920
969
  "batch_size": batch_size,
921
970
  "max_batching_window": max_batching_window,
922
971
  },
972
+ timeout=timeout,
973
+ memory=memory,
974
+ ephemeral_storage=ephemeral_storage,
923
975
  **kwargs,
924
976
  )
925
977
  )
@@ -928,7 +980,14 @@ class AsyncLambdaController:
928
980
 
929
981
  return _task
930
982
 
931
- def pure_task(self, task_id: str, **kwargs):
983
+ def pure_task(
984
+ self,
985
+ task_id: str,
986
+ timeout: int = 60,
987
+ memory: Optional[int] = None,
988
+ ephemeral_storage: int = 512,
989
+ **kwargs,
990
+ ):
932
991
  """
933
992
  Decorate a function to register it as a pure lambda function.
934
993
  """
@@ -947,6 +1006,9 @@ class AsyncLambdaController:
947
1006
  task_id=task_id,
948
1007
  trigger_type=TaskTriggerType.BASE_EVENT,
949
1008
  trigger_config={},
1009
+ timeout=timeout,
1010
+ memory=memory,
1011
+ ephemeral_storage=ephemeral_storage,
950
1012
  **kwargs,
951
1013
  )
952
1014
  )
@@ -65,7 +65,7 @@ class AsyncLambdaTask(Generic[EventType, RT]):
65
65
  trigger_config: dict
66
66
 
67
67
  timeout: int
68
- memory: int
68
+ memory: Optional[int]
69
69
  ephemeral_storage: int
70
70
  maximum_concurrency: Optional[Union[int, List[int]]]
71
71
  init_tasks: List[Union[Callable[[str], Any], Callable[[], Any]]]
@@ -81,7 +81,7 @@ class AsyncLambdaTask(Generic[EventType, RT]):
81
81
  trigger_type: TaskTriggerType,
82
82
  trigger_config: Optional[dict] = None,
83
83
  timeout: int = 60,
84
- memory: int = 128,
84
+ memory: Optional[int] = None,
85
85
  ephemeral_storage: int = 512,
86
86
  maximum_concurrency: Optional[Union[int, List[int]]] = None,
87
87
  init_tasks: Optional[
@@ -447,7 +447,9 @@ class AsyncLambdaTask(Generic[EventType, RT]):
447
447
  "FunctionName": self.get_function_name(),
448
448
  "CodeUri": ".async_lambda/build/deployment.zip",
449
449
  "EphemeralStorage": {"Size": self.ephemeral_storage},
450
- "MemorySize": self.memory,
450
+ "MemorySize": (
451
+ self.memory if self.memory else config.default_task_memory
452
+ ),
451
453
  "Timeout": self.timeout,
452
454
  "Events": events,
453
455
  "Policies": [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: async-lambda-unstable
3
- Version: 0.5.4
3
+ Version: 0.5.6
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