lithops-cloud / lithops

A multi-cloud framework for big data analytics and embarrassingly parallel jobs, that provides an universal API for building parallel applications in the cloud ☁️🚀
http://lithops.cloud
Apache License 2.0
317 stars 105 forks source link

Can't delete aws_lambda images #1290

Closed tomwhite closed 6 months ago

tomwhite commented 6 months ago

When I try to delete an image I get runtime not found:

> lithops runtime delete -b aws_lambda -d cubed-runtime-dev        
2024-03-27 16:55:46,090 [INFO] config.py:139 -- Lithops v3.1.3.dev1 - Python3.9
2024-03-27 16:55:46,090 [DEBUG] config.py:101 -- Loading configuration from /Users/tom/.lithops/config.aws
2024-03-27 16:55:46,102 [DEBUG] config.py:191 -- Loading Serverless backend module: aws_lambda
2024-03-27 16:55:46,136 [DEBUG] config.py:234 -- Loading Storage backend module: aws_s3
2024-03-27 16:55:46,137 [DEBUG] aws_s3.py:37 -- Creating S3 client
2024-03-27 16:55:46,210 [INFO] aws_s3.py:68 -- S3 client created - Region: eu-west-1
2024-03-27 16:55:46,488 [DEBUG] aws_lambda.py:53 -- Creating AWS Lambda client
2024-03-27 16:55:46,488 [DEBUG] aws_lambda.py:64 -- Creating Boto3 AWS Session and Lambda Client
2024-03-27 16:55:47,685 [INFO] aws_lambda.py:106 -- AWS Lambda client created - Region: eu-west-1
2024-03-27 16:55:48,261 [INFO] cli.py:639 -- Runtime not found

Even though the image is correctly listed:

> lithops runtime list
2024-03-27 16:55:31,510 [INFO] config.py:139 -- Lithops v3.1.3.dev1 - Python3.9
2024-03-27 16:55:32,824 [INFO] aws_lambda.py:106 -- AWS Lambda client created - Region: eu-west-1

Runtime Name          Memory Size  Lithops Version    Worker Name
------------------  -------------  -----------------  ----------------------------------
cubed-runtime-dev            2000  3.1.2              lithops-worker-2610-312-03651cff2a
cubed-runtime-dev            2048  3.1.2              lithops-worker-2610-312-6b37d155ab
cubed-runtime                2000  3.1.2              lithops-worker-2610-312-48c69cde40
cubed-runtime-main           2000  3.1.2              lithops-worker-2610-312-3f54d2a9d5

Total runtimes: 4
tomwhite commented 6 months ago

It looks like the code assumes the runtime names end with :latest, which isn't the case here. If I make the following change I can delete images successfully:

iff --git a/lithops/serverless/backends/aws_lambda/aws_lambda.py b/lithops/serverless/backends/aws_lambda/aws_lambda.py
index d44173de..ba95dbba 100644
--- a/lithops/serverless/backends/aws_lambda/aws_lambda.py
+++ b/lithops/serverless/backends/aws_lambda/aws_lambda.py
@@ -610,9 +610,7 @@ class AWSLambdaBackend:
             get_runtimes(response)

         if runtime_name != 'all':
-            if self._is_container_runtime(runtime_name) and ':' not in runtime_name:
-                runtime_name = runtime_name + ':latest'
-            runtimes = [tup for tup in runtimes if runtime_name in tup[0]]
+            runtimes = [tup for tup in runtimes if runtime_name == tup[0]]

         return runtimes
marcelo321 commented 1 month ago

I still can't delete it, anyone found how to fix this?