2323
2424from veadk .config import getenv
2525from veadk .utils .logger import get_logger
26+ from veadk .integrations .ve_faas .ve_faas import VeFaaS
2627
2728logger = get_logger (__name__ )
2829
@@ -242,6 +243,7 @@ async def _get_a2a_client(self) -> A2AClient:
242243
243244 def update_self (
244245 self ,
246+ path : str ,
245247 volcengine_ak : str = getenv ("VOLCENGINE_ACCESS_KEY" ),
246248 volcengine_sk : str = getenv ("VOLCENGINE_SECRET_KEY" ),
247249 ):
@@ -267,7 +269,25 @@ def update_self(
267269 if not volcengine_ak or not volcengine_sk :
268270 raise ValueError ("Volcengine access key and secret key must be set." )
269271
270- # TODO(floritange): support update cloud app
272+ if not self .vefaas_application_id :
273+ self .vefaas_application_id = self ._get_vefaas_application_id_by_name ()
274+
275+ vefaas_client = VeFaaS (access_key = volcengine_ak , secret_key = volcengine_sk )
276+
277+ try :
278+ vefaas_application_url , app_id , function_id = (
279+ vefaas_client ._update_function_code (
280+ application_name = self .vefaas_application_name ,
281+ path = path ,
282+ )
283+ )
284+ self .vefaas_endpoint = vefaas_application_url
285+ self .vefaas_application_id = app_id
286+ logger .info (
287+ f"Cloud app { self .vefaas_application_name } updated successfully."
288+ )
289+ except Exception as e :
290+ raise ValueError (f"Failed to update cloud app. Error: { e } " )
271291
272292 def delete_self (
273293 self ,
@@ -392,8 +412,7 @@ async def message_send(
392412 # from CloudApp will not be `Task` type
393413 return res .root .result # type: ignore
394414 except Exception as e :
395- # TODO(floritange): show error log on VeFaaS function
396- print (e )
415+ logger .error (f"Failed to send message to cloud app. Error: { e } " )
397416 return None
398417
399418
0 commit comments