Skip to content

Commit 15cbf76

Browse files
committed
Lazy init PipelineManager
1 parent 1ed5042 commit 15cbf76

File tree

1 file changed

+7
-3
lines changed
  • src/dstack/_internal/server/background/pipeline_tasks

1 file changed

+7
-3
lines changed

src/dstack/_internal/server/background/pipeline_tasks/__init__.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,13 @@ def hint_fetch(self, model_name: str):
8585
pipeline.hint_fetch()
8686

8787

88-
_pipeline_manager = PipelineManager()
88+
_pipeline_manager = None
8989

9090

9191
def get_pipeline_manager() -> PipelineManager:
92+
global _pipeline_manager
93+
if _pipeline_manager is None:
94+
_pipeline_manager = PipelineManager()
9295
return _pipeline_manager
9396

9497

@@ -97,5 +100,6 @@ def start_pipeline_tasks() -> PipelineManager:
97100
Start tasks processed by fetch-workers pipelines based on db + in-memory queues.
98101
Suitable for tasks that run frequently and need to lock rows for a long time.
99102
"""
100-
_pipeline_manager.start()
101-
return _pipeline_manager
103+
pipeline_manager = get_pipeline_manager()
104+
pipeline_manager.start()
105+
return pipeline_manager

0 commit comments

Comments
 (0)