File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change 52
52
ModelsTree , # only when num workers = 1
53
53
)
54
54
55
- # concurrency
56
- from cortex .lib .concurrency import FileLock
57
-
58
55
# model validation
59
56
from cortex .lib .model import validate_model_paths
60
57
@@ -245,10 +242,9 @@ def class_impl(self, project_dir):
245
242
validations = PYTHON_CLASS_VALIDATION
246
243
247
244
try :
248
- with FileLock ("/run/init_stagger.lock" ):
249
- predictor_class = self ._get_class_impl (
250
- "cortex_predictor" , os .path .join (project_dir , self .path ), target_class_name
251
- )
245
+ predictor_class = self ._get_class_impl (
246
+ "cortex_predictor" , os .path .join (project_dir , self .path ), target_class_name
247
+ )
252
248
except CortexException as e :
253
249
e .wrap ("error in " + self .path )
254
250
raise
Original file line number Diff line number Diff line change 35
35
from cortex .lib import util
36
36
from cortex .lib .api import API , get_api
37
37
from cortex .lib .log import cx_logger as logger
38
- from cortex .lib .concurrency import LockedFile
38
+ from cortex .lib .concurrency import FileLock , LockedFile
39
39
from cortex .lib .storage import S3 , LocalStorage
40
40
from cortex .lib .exceptions import UserRuntimeException
41
41
@@ -304,8 +304,10 @@ def start_fn():
304
304
client = api .predictor .initialize_client (
305
305
tf_serving_host = tf_serving_host , tf_serving_port = tf_serving_port
306
306
)
307
- logger ().info ("loading the predictor from {}" .format (api .predictor .path ))
308
- predictor_impl = api .predictor .initialize_impl (project_dir , client )
307
+
308
+ with FileLock ("/run/init_stagger.lock" ):
309
+ logger ().info ("loading the predictor from {}" .format (api .predictor .path ))
310
+ predictor_impl = api .predictor .initialize_impl (project_dir , client )
309
311
310
312
local_cache ["api" ] = api
311
313
local_cache ["provider" ] = provider
You can’t perform that action at this time.
0 commit comments