提交 e49db642 编写于 作者: B barrierye

add concurrency_idx into init_op func

上级 f17f924e
...@@ -197,7 +197,7 @@ class Op(object): ...@@ -197,7 +197,7 @@ class Op(object):
threads.append(t) threads.append(t)
return threads return threads
def init_op(self): def init_op(self, concurrency_idx):
pass pass
def _run_preprocess(self, parsed_data, data_id, log_func): def _run_preprocess(self, parsed_data, data_id, log_func):
...@@ -343,10 +343,10 @@ class Op(object): ...@@ -343,10 +343,10 @@ class Op(object):
if use_multithread: if use_multithread:
with self._for_init_op_lock: with self._for_init_op_lock:
if not self._succ_init_op: if not self._succ_init_op:
self.init_op() self.init_op(concurrency_idx)
self._succ_init_op = True self._succ_init_op = True
else: else:
self.init_op() self.init_op(concurrency_idx)
except Exception as e: except Exception as e:
_LOGGER.error(log(e)) _LOGGER.error(log(e))
os._exit(-1) os._exit(-1)
...@@ -425,7 +425,7 @@ class RequestOp(Op): ...@@ -425,7 +425,7 @@ class RequestOp(Op):
name="@G", input_ops=[], concurrency=concurrency) name="@G", input_ops=[], concurrency=concurrency)
# init op # init op
try: try:
self.init_op() self.init_op(0)
except Exception as e: except Exception as e:
_LOGGER.error(e) _LOGGER.error(e)
os._exit(-1) os._exit(-1)
...@@ -450,7 +450,7 @@ class ResponseOp(Op): ...@@ -450,7 +450,7 @@ class ResponseOp(Op):
name="@R", input_ops=input_ops, concurrency=concurrency) name="@R", input_ops=input_ops, concurrency=concurrency)
# init op # init op
try: try:
self.init_op() self.init_op(0)
except Exception as e: except Exception as e:
_LOGGER.error(e) _LOGGER.error(e)
os._exit(-1) os._exit(-1)
......
...@@ -50,6 +50,8 @@ class TimeProfiler(object): ...@@ -50,6 +50,8 @@ class TimeProfiler(object):
self._time_record.put((name, tag, timestamp)) self._time_record.put((name, tag, timestamp))
def print_profile(self): def print_profile(self):
if self._enable is False:
return
sys.stderr.write(self.gen_profile_str()) sys.stderr.write(self.gen_profile_str())
def gen_profile_str(self): def gen_profile_str(self):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册