diff --git a/python/pipeline/operator.py b/python/pipeline/operator.py index 9a569abd1928335efb4409220993a603ac0e60a9..accfdfce7a50643a5b5fb2ae74baf03d5b13f941 100644 --- a/python/pipeline/operator.py +++ b/python/pipeline/operator.py @@ -197,7 +197,7 @@ class Op(object): threads.append(t) return threads - def init_op(self): + def init_op(self, concurrency_idx): pass def _run_preprocess(self, parsed_data, data_id, log_func): @@ -343,10 +343,10 @@ class Op(object): if use_multithread: with self._for_init_op_lock: if not self._succ_init_op: - self.init_op() + self.init_op(concurrency_idx) self._succ_init_op = True else: - self.init_op() + self.init_op(concurrency_idx) except Exception as e: _LOGGER.error(log(e)) os._exit(-1) @@ -425,7 +425,7 @@ class RequestOp(Op): name="@G", input_ops=[], concurrency=concurrency) # init op try: - self.init_op() + self.init_op(0) except Exception as e: _LOGGER.error(e) os._exit(-1) @@ -450,7 +450,7 @@ class ResponseOp(Op): name="@R", input_ops=input_ops, concurrency=concurrency) # init op try: - self.init_op() + self.init_op(0) except Exception as e: _LOGGER.error(e) os._exit(-1) diff --git a/python/pipeline/profiler.py b/python/pipeline/profiler.py index df497c48cc8781bda597dd45c15bbf48c2bc9b63..e6fe43b10a17aafc2b4058c47e72f1e640e7912e 100644 --- a/python/pipeline/profiler.py +++ b/python/pipeline/profiler.py @@ -50,6 +50,8 @@ class TimeProfiler(object): self._time_record.put((name, tag, timestamp)) def print_profile(self): + if self._enable is False: + return sys.stderr.write(self.gen_profile_str()) def gen_profile_str(self):