11from osbot_aws .AWS_Config import AWS_Config
22from osbot_aws .deploy .Deploy_Lambda import Deploy_Lambda
3+ from osbot_aws .helpers .Lambda_Upload_Package import Lambda_Upload_Package
34from osbot_utils .decorators .methods .cache_on_self import cache_on_self
45from osbot_utils .helpers .Safe_Id import Safe_Id
56from osbot_utils .type_safe .Type_Safe import Type_Safe
@@ -29,9 +30,16 @@ def deploy_lambda(self):
2930 def deploy (self ):
3031 with self .deploy_lambda () as _ :
3132 result = _ .update ()
32- if result != "Successful" :
33- raise Exception (f"Lambda update failed: { result } " )
34- return True
33+ print (f"***** : { result } " )
34+ if result == "Successful" :
35+ return True
36+ if result == 'Pending' :
37+ print (">>>>>>> Pending result >>>> going to wait a bit more" )
38+ wait_result = self .lambda_function ().wait_for_function_update_to_complete ()
39+ print (f">>>>>>>> WAIT RESULT: { wait_result } " ) # todo add check here
40+ return True
41+ raise Exception (f"Lambda update failed: { result } " )
42+
3543
3644 def lambda_name (self ):
3745 return f'{ BASE__LAMBDA_NAME } __{ self .stage } '
@@ -55,3 +63,9 @@ def setup_aws_environment(self):
5563 if result .get ('status' ) == 'ok' :
5664 _ .bucket__osbot_lambdas__exists = True
5765 return aws_setup
66+
67+ def upload_lambda_dependencies_to_s3 (self ):
68+ packages = ['fastapi' ]
69+ lambda_upload_package = Lambda_Upload_Package ()
70+ for package in packages :
71+ return lambda_upload_package .install_locally (package )
0 commit comments