Skip to content

Commit d64c756

Browse files
authored
Stagger __init__ calls (#1543)
1 parent f8f832a commit d64c756

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pkg/workloads/cortex/lib/type/predictor.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
from cortex.lib.log import refresh_logger, cx_logger
2323
from cortex.lib.exceptions import CortexException, UserException, UserRuntimeException
2424
from cortex.lib.type.model import Model, get_model_signature_map
25+
from cortex.lib.storage.concurrency import FileLock
2526
from cortex import consts
2627
from cortex.lib import util
2728

@@ -134,7 +135,8 @@ def class_impl(self, project_dir):
134135
target_class_name, validations = self.get_target_and_validations()
135136

136137
try:
137-
impl = self._load_module("cortex_predictor", os.path.join(project_dir, self.path))
138+
with FileLock("/run/init_stagger.lock"):
139+
impl = self._load_module("cortex_predictor", os.path.join(project_dir, self.path))
138140
except CortexException as e:
139141
e.wrap("error in " + self.path)
140142
raise

0 commit comments

Comments
 (0)