@@ -146,7 +146,7 @@ def wait_till_registry_is_responsive(url: str) -> bool:
146146# ********************************************************* Services ***************************************
147147
148148
149- def _pull_push_service (
149+ async def _pull_push_service (
150150 pull_key : str ,
151151 tag : str ,
152152 new_registry : str ,
@@ -213,11 +213,13 @@ def _pull_push_service(
213213 assert image .tag (new_image_tag )
214214
215215 # push the image to the new location
216- with log_context (
217- logging .INFO ,
218- msg = f"Pushing { pull_key } :{ tag } -> { new_image_tag } ..." ,
219- ):
220- client .images .push (new_image_tag )
216+ async with aiodocker .Docker () as client :
217+ await client .images .push (new_image_tag )
218+ # with log_context(
219+ # logging.INFO,
220+ # msg=f"Pushing {pull_key}:{tag} -> {new_image_tag} ...",
221+ # ):
222+ # client.images.push(new_image_tag)
221223
222224 # return image io.simcore.* labels
223225 image_labels = dict (image .labels )
@@ -230,10 +232,10 @@ def _pull_push_service(
230232 }
231233
232234
233- @pytest .fixture ( scope = "session" )
235+ @pytest .fixture
234236def docker_registry_image_injector (
235237 docker_registry : str , node_meta_schema : dict
236- ) -> Callable [..., dict [str , Any ]]:
238+ ) -> Callable [[ str , str , str | None ], Awaitable [ dict [str , Any ] ]]:
237239 def inject_image (
238240 source_image_repo : str , source_image_tag : str , owner_email : str | None = None
239241 ):
@@ -249,82 +251,86 @@ def inject_image(
249251
250252
251253@pytest .fixture
252- def osparc_service (
254+ async def osparc_service (
253255 docker_registry : str , node_meta_schema : dict , service_repo : str , service_tag : str
254256) -> dict [str , Any ]:
255257 """pulls the service from service_repo:service_tag and pushes to docker_registry using the oSparc node meta schema
256258 NOTE: 'service_repo' and 'service_tag' defined as parametrization
257259 """
258- return _pull_push_service (
260+ return await _pull_push_service (
259261 service_repo , service_tag , docker_registry , node_meta_schema
260262 )
261263
262264
263- @pytest .fixture (scope = "session" )
264- def sleeper_service (docker_registry : str , node_meta_schema : dict ) -> dict [str , Any ]:
265+ @pytest .fixture
266+ async def sleeper_service (
267+ docker_registry : str , node_meta_schema : dict
268+ ) -> dict [str , Any ]:
265269 """Adds a itisfoundation/sleeper in docker registry"""
266- return _pull_push_service (
270+ return await _pull_push_service (
267271 "itisfoundation/sleeper" , "1.0.0" , docker_registry , node_meta_schema
268272 )
269273
270274
271- @pytest .fixture (scope = "session" )
272- def jupyter_service (docker_registry : str , node_meta_schema : dict ) -> dict [str , Any ]:
275+ @pytest .fixture
276+ async def jupyter_service (
277+ docker_registry : str , node_meta_schema : dict
278+ ) -> dict [str , Any ]:
273279 """Adds a itisfoundation/jupyter-base-notebook in docker registry"""
274- return _pull_push_service (
280+ return await _pull_push_service (
275281 "itisfoundation/jupyter-base-notebook" ,
276282 "2.13.0" ,
277283 docker_registry ,
278284 node_meta_schema ,
279285 )
280286
281287
282- @pytest .fixture (scope = "session" , params = ["2.0.7" ])
288+ @pytest .fixture (params = ["2.0.7" ])
283289def dy_static_file_server_version (request : pytest .FixtureRequest ):
284290 return request .param
285291
286292
287- @pytest .fixture ( scope = "session" )
288- def dy_static_file_server_service (
293+ @pytest .fixture
294+ async def dy_static_file_server_service (
289295 docker_registry : str , node_meta_schema : dict , dy_static_file_server_version : str
290296) -> dict [str , Any ]:
291297 """
292298 Adds the below service in docker registry
293299 itisfoundation/dy-static-file-server
294300 """
295- return _pull_push_service (
301+ return await _pull_push_service (
296302 "itisfoundation/dy-static-file-server" ,
297303 dy_static_file_server_version ,
298304 docker_registry ,
299305 node_meta_schema ,
300306 )
301307
302308
303- @pytest .fixture ( scope = "session" )
304- def dy_static_file_server_dynamic_sidecar_service (
309+ @pytest .fixture
310+ async def dy_static_file_server_dynamic_sidecar_service (
305311 docker_registry : str , node_meta_schema : dict , dy_static_file_server_version : str
306312) -> dict [str , Any ]:
307313 """
308314 Adds the below service in docker registry
309315 itisfoundation/dy-static-file-server-dynamic-sidecar
310316 """
311- return _pull_push_service (
317+ return await _pull_push_service (
312318 "itisfoundation/dy-static-file-server-dynamic-sidecar" ,
313319 dy_static_file_server_version ,
314320 docker_registry ,
315321 node_meta_schema ,
316322 )
317323
318324
319- @pytest .fixture ( scope = "session" )
320- def dy_static_file_server_dynamic_sidecar_compose_spec_service (
325+ @pytest .fixture
326+ async def dy_static_file_server_dynamic_sidecar_compose_spec_service (
321327 docker_registry : str , node_meta_schema : dict , dy_static_file_server_version : str
322328) -> dict [str , Any ]:
323329 """
324330 Adds the below service in docker registry
325331 itisfoundation/dy-static-file-server-dynamic-sidecar-compose-spec
326332 """
327- return _pull_push_service (
333+ return await _pull_push_service (
328334 "itisfoundation/dy-static-file-server-dynamic-sidecar-compose-spec" ,
329335 dy_static_file_server_version ,
330336 docker_registry ,
0 commit comments