Skip to content

Commit 482c544

Browse files
authored
🐛Correctly handle file type of on-demand clusters (#5101)
1 parent 00c54cd commit 482c544

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

services/director-v2/src/simcore_service_director_v2/modules/dask_clients_pool.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ async def _concurently_safe_acquire_client() -> DaskClient:
8080
tasks_file_link_type = (
8181
self.settings.COMPUTATIONAL_BACKEND_DEFAULT_CLUSTER_FILE_LINK_TYPE
8282
)
83-
if cluster.type is ClusterTypeInModel.ON_DEMAND:
83+
if cluster.type == ClusterTypeInModel.ON_DEMAND.value:
8484
tasks_file_link_type = (
8585
self.settings.COMPUTATIONAL_BACKEND_ON_DEMAND_CLUSTERS_FILE_LINK_TYPE
8686
)

services/storage/src/simcore_service_storage/exceptions.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class S3AccessError(StorageRuntimeError):
4444

4545
class S3BucketInvalidError(S3AccessError):
4646
code = "s3_bucket.invalid_error"
47-
msg_template: str = "The {bucket} is invalid"
47+
msg_template: str = "The bucket '{bucket}' is invalid"
4848

4949

5050
class S3KeyNotFoundError(S3AccessError):

services/storage/src/simcore_service_storage/handlers_files.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -193,10 +193,9 @@ async def upload_file(request: web.Request) -> web.Response:
193193
if query_params.file_size is None and not query_params.is_directory:
194194
# return v1 response
195195
assert len(links.urls) == 1 # nosec
196-
return web.json_response(
197-
{"data": {"link": jsonable_encoder(links.urls[0], by_alias=True)}},
198-
dumps=json_dumps,
199-
)
196+
response = {"data": {"link": jsonable_encoder(links.urls[0], by_alias=True)}}
197+
log.debug("Returning v1 response: %s", response)
198+
return web.json_response(response, dumps=json_dumps)
200199

201200
# v2 response
202201
abort_url = request.url.join(
@@ -226,7 +225,7 @@ async def upload_file(request: web.Request) -> web.Response:
226225
),
227226
),
228227
)
229-
228+
log.debug("returning v2 response: %s", response)
230229
return jsonable_encoder(response, by_alias=True)
231230

232231

services/storage/src/simcore_service_storage/simcore_s3_dsm.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -805,12 +805,13 @@ async def _clean_expired_uploads(self):
805805
list_of_expired_uploads = await db_file_meta_data.list_fmds(
806806
conn, expired_after=now
807807
)
808+
809+
if not list_of_expired_uploads:
810+
return
808811
_logger.debug(
809812
"found following pending uploads: [%s]",
810813
[fmd.file_id for fmd in list_of_expired_uploads],
811814
)
812-
if not list_of_expired_uploads:
813-
return
814815

815816
# try first to upload these from S3 (conservative)
816817
updated_fmds = await logged_gather(

0 commit comments

Comments
 (0)