From 0a14c61f793b526c9a7e2ca40b154b9299d20738 Mon Sep 17 00:00:00 2001 From: Saket Bhatt Date: Thu, 23 Jan 2025 19:50:14 -0500 Subject: [PATCH 1/2] iluvatar init --- lithops/constants.py | 3 ++- lithops/serverless/backends/iluvatar/__init__.py | 0 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 lithops/serverless/backends/iluvatar/__init__.py diff --git a/lithops/constants.py b/lithops/constants.py index 84303102f..335431a67 100644 --- a/lithops/constants.py +++ b/lithops/constants.py @@ -111,7 +111,8 @@ 'aliyun_fc', 'oracle_f', 'k8s', - 'singularity' + 'singularity', + 'iluvatar', ] STANDALONE_BACKENDS = [ diff --git a/lithops/serverless/backends/iluvatar/__init__.py b/lithops/serverless/backends/iluvatar/__init__.py new file mode 100644 index 000000000..e69de29bb From 5d0bf20ba43eeaf7e69d308f397d40c9e33b59ad Mon Sep 17 00:00:00 2001 From: Saket Bhatt Date: Wed, 26 Feb 2025 14:43:49 -0500 Subject: [PATCH 2/2] fix for GCP functions --- lithops/constants.py | 3 +-- .../backends/gcp_functions/gcp_functions.py | 20 +++++++++---------- .../serverless/backends/iluvatar/__init__.py | 0 3 files changed, 11 insertions(+), 12 deletions(-) delete mode 100644 lithops/serverless/backends/iluvatar/__init__.py diff --git a/lithops/constants.py b/lithops/constants.py index 335431a67..84303102f 100644 --- a/lithops/constants.py +++ b/lithops/constants.py @@ -111,8 +111,7 @@ 'aliyun_fc', 'oracle_f', 'k8s', - 'singularity', - 'iluvatar', + 'singularity' ] STANDALONE_BACKENDS = [ diff --git a/lithops/serverless/backends/gcp_functions/gcp_functions.py b/lithops/serverless/backends/gcp_functions/gcp_functions.py index 7bd060d54..67efa7572 100644 --- a/lithops/serverless/backends/gcp_functions/gcp_functions.py +++ b/lithops/serverless/backends/gcp_functions/gcp_functions.py @@ -244,26 +244,26 @@ def _create_function(self, runtime_name, memory, timeout=60): 'failurePolicy': {} } - response = self._api_resource.projects().locations().functions().create( + operation = self._api_resource.projects().locations().functions().create( location=self._default_location, body=cloud_function ).execute(num_retries=self.num_retries) # Wait until the function is completely deployed logger.info('Waiting for the function to be deployed') + operation_name = operation['name'] while True: - response = self._api_resource.projects().locations().functions().get( - name=function_location + op_status = self._api_resource.operations().get( + name=operation_name ).execute(num_retries=self.num_retries) - logger.debug(f'Function status is {response["status"]}') - if response['status'] == 'ACTIVE': + if op_status.get('done'): + if 'error' in op_status: + raise Exception(f'Error while deploying Cloud Function: {op_status["error"]}') + logger.info("Deployment completed successfully.") break - elif response['status'] == 'OFFLINE': - raise Exception('Error while deploying Cloud Function') - elif response['status'] == 'DEPLOY_IN_PROGRESS': - time.sleep(self.retry_sleep) else: - raise Exception(f"Unknown status {response['status']}") + logger.debug("Deployment in progress, waiting...") + time.sleep(self.retry_sleep) def build_runtime(self, runtime_name, requirements_file, extra_args=[]): if not requirements_file: diff --git a/lithops/serverless/backends/iluvatar/__init__.py b/lithops/serverless/backends/iluvatar/__init__.py deleted file mode 100644 index e69de29bb..000000000