提交 b8b53511 编写于 作者: B barrierye

fix profile in client

上级 f4331f20
...@@ -90,12 +90,12 @@ class ChannelData(object): ...@@ -90,12 +90,12 @@ class ChannelData(object):
self.ecode = ecode self.ecode = ecode
self.error_info = error_info self.error_info = error_info
self.client_need_profile = client_need_profile self.client_need_profile = client_need_profile
self.profile_data_list = [] self.profile_data_set = set()
def add_profile(self, profile_list): def add_profile(self, profile_set):
if self.client_need_profile is False: if self.client_need_profile is False:
self.client_need_profile = True self.client_need_profile = True
self.profile_data_list.extend(profile_list) self.profile_data_set |= profile_set
@staticmethod @staticmethod
def check_dictdata(dictdata): def check_dictdata(dictdata):
......
...@@ -241,9 +241,9 @@ class DAGExecutor(object): ...@@ -241,9 +241,9 @@ class DAGExecutor(object):
# add profile info into rpc_resp # add profile info into rpc_resp
profile_value = "" profile_value = ""
if resp_channeldata.client_need_profile: if resp_channeldata.client_need_profile:
profile_list = resp_channeldata.profile_data_list profile_set = resp_channeldata.profile_data_set
profile_list.append(profile_str) profile_set.add(profile_str)
profile_value = "".join(profile_list) profile_value = "".join(list(profile_set))
rpc_resp.key.append(self._client_profile_key) rpc_resp.key.append(self._client_profile_key)
rpc_resp.value.append(profile_value) rpc_resp.value.append(profile_value)
......
...@@ -162,7 +162,7 @@ class Op(object): ...@@ -162,7 +162,7 @@ class Op(object):
def _parse_channeldata(self, channeldata_dict): def _parse_channeldata(self, channeldata_dict):
data_id, error_channeldata = None, None data_id, error_channeldata = None, None
client_need_profile, profile_list = False, [] client_need_profile, profile_set = False, set()
parsed_data = {} parsed_data = {}
key = list(channeldata_dict.keys())[0] key = list(channeldata_dict.keys())[0]
...@@ -175,32 +175,32 @@ class Op(object): ...@@ -175,32 +175,32 @@ class Op(object):
break break
parsed_data[name] = data.parse() parsed_data[name] = data.parse()
if client_need_profile: if client_need_profile:
profile_list.extend(data.profile_data_list) profile_set |= data.profile_data_set
return (data_id, error_channeldata, parsed_data, client_need_profile, return (data_id, error_channeldata, parsed_data, client_need_profile,
profile_list) profile_set)
def _push_to_output_channels(self, def _push_to_output_channels(self,
data, data,
channels, channels,
name=None, name=None,
client_need_profile=False, client_need_profile=False,
profile_list=None): profile_set=None):
if name is None: if name is None:
name = self.name name = self.name
self._add_profile_into_channeldata(data, client_need_profile, self._add_profile_into_channeldata(data, client_need_profile,
profile_list) profile_set)
for channel in channels: for channel in channels:
channel.push(data, name) channel.push(data, name)
def _add_profile_into_channeldata(self, data, client_need_profile, def _add_profile_into_channeldata(self, data, client_need_profile,
profile_list): profile_set):
profile_str = self._profiler.gen_profile_str() profile_str = self._profiler.gen_profile_str()
if self._server_use_profile: if self._server_use_profile:
sys.stderr.write(profile_str) sys.stderr.write(profile_str)
if client_need_profile and profile_list is not None: if client_need_profile and profile_set is not None:
profile_list.append(profile_str) profile_set.add(profile_str)
data.add_profile(profile_list) data.add_profile(profile_set)
def start_with_process(self, client_type): def start_with_process(self, client_type):
proces = [] proces = []
...@@ -398,7 +398,7 @@ class Op(object): ...@@ -398,7 +398,7 @@ class Op(object):
_LOGGER.debug(log("input_data: {}".format(channeldata_dict))) _LOGGER.debug(log("input_data: {}".format(channeldata_dict)))
(data_id, error_channeldata, parsed_data, client_need_profile, (data_id, error_channeldata, parsed_data, client_need_profile,
profile_list) = self._parse_channeldata(channeldata_dict) profile_set) = self._parse_channeldata(channeldata_dict)
# error data in predecessor Op # error data in predecessor Op
if error_channeldata is not None: if error_channeldata is not None:
try: try:
...@@ -421,7 +421,7 @@ class Op(object): ...@@ -421,7 +421,7 @@ class Op(object):
error_channeldata, error_channeldata,
output_channels, output_channels,
client_need_profile=client_need_profile, client_need_profile=client_need_profile,
profile_list=profile_list) profile_set=profile_set)
except ChannelStopError: except ChannelStopError:
_LOGGER.debug(log("stop.")) _LOGGER.debug(log("stop."))
break break
...@@ -438,7 +438,7 @@ class Op(object): ...@@ -438,7 +438,7 @@ class Op(object):
error_channeldata, error_channeldata,
output_channels, output_channels,
client_need_profile=client_need_profile, client_need_profile=client_need_profile,
profile_list=profile_list) profile_set=profile_set)
except ChannelStopError: except ChannelStopError:
_LOGGER.debug(log("stop.")) _LOGGER.debug(log("stop."))
break break
...@@ -455,7 +455,7 @@ class Op(object): ...@@ -455,7 +455,7 @@ class Op(object):
error_channeldata, error_channeldata,
output_channels, output_channels,
client_need_profile=client_need_profile, client_need_profile=client_need_profile,
profile_list=profile_list) profile_set=profile_set)
except ChannelStopError: except ChannelStopError:
_LOGGER.debug(log("stop.")) _LOGGER.debug(log("stop."))
break break
...@@ -468,7 +468,7 @@ class Op(object): ...@@ -468,7 +468,7 @@ class Op(object):
output_data, output_data,
output_channels, output_channels,
client_need_profile=client_need_profile, client_need_profile=client_need_profile,
profile_list=profile_list) profile_set=profile_set)
except ChannelStopError: except ChannelStopError:
_LOGGER.debug(log("stop.")) _LOGGER.debug(log("stop."))
break break
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册