|
25 | 25 | from servicelib.common_headers import UNDEFINED_DEFAULT_SIMCORE_USER_AGENT_VALUE |
26 | 26 | from servicelib.logging_errors import create_troubleshootting_log_kwargs |
27 | 27 | from servicelib.logging_utils import log_catch, log_context |
28 | | -from servicelib.redis import with_limited_concurrency |
29 | 28 | from servicelib.utils import limited_as_completed, limited_gather |
30 | 29 |
|
31 | 30 | from ...core.errors import ( |
|
55 | 54 | from ..db.repositories.comp_tasks import CompTasksRepository |
56 | 55 | from ._constants import ( |
57 | 56 | MAX_CONCURRENT_PIPELINE_SCHEDULING, |
58 | | - MODULE_NAME_WORKER, |
59 | 57 | ) |
60 | 58 | from ._models import TaskStateTracker |
61 | 59 | from ._scheduler_base import BaseCompScheduler |
62 | 60 | from ._utils import ( |
63 | 61 | WAITING_FOR_START_STATES, |
64 | | - get_redis_client_from_app, |
65 | | - get_redis_lock_key, |
66 | 62 | ) |
67 | 63 |
|
68 | 64 | _logger = logging.getLogger(__name__) |
@@ -97,26 +93,12 @@ async def _cluster_dask_client( |
97 | 93 | wallet_id=run_metadata.get("wallet_id"), |
98 | 94 | ) |
99 | 95 |
|
100 | | - @asynccontextmanager |
101 | | - @with_limited_concurrency( |
102 | | - get_redis_client_from_app, |
103 | | - key=get_redis_lock_key( |
104 | | - MODULE_NAME_WORKER, unique_lock_key_builder=create_cluster_client_lock_key |
| 96 | + async with scheduler.dask_clients_pool.acquire( |
| 97 | + cluster, |
| 98 | + ref=_DASK_CLIENT_RUN_REF.format( |
| 99 | + user_id=user_id, project_id=project_id, run_id=run_id |
105 | 100 | ), |
106 | | - capacity=_DASK_SCHEDULER_MAX_CONCURRENT_ACCESS, |
107 | | - blocking=True, |
108 | | - blocking_timeout=None, |
109 | | - ) |
110 | | - async def _limited_client_pool() -> AsyncIterator[DaskClient]: |
111 | | - async with scheduler.dask_clients_pool.acquire( |
112 | | - cluster, |
113 | | - ref=_DASK_CLIENT_RUN_REF.format( |
114 | | - user_id=user_id, project_id=project_id, run_id=run_id |
115 | | - ), |
116 | | - ) as client: |
117 | | - yield client |
118 | | - |
119 | | - async with _limited_client_pool() as client: |
| 101 | + ) as client: |
120 | 102 | yield client |
121 | 103 |
|
122 | 104 |
|
|
0 commit comments