Skip to content

Commit

Permalink
hape: remove bs choice in upc and add user_cmd when starting single w… (
Browse files Browse the repository at this point in the history
#43)

1.
当start子命令带上--worker选项时会重启节点。之前的实现没带上user_cmd为start-worker,可能导致执行命令的作用为重复上一次命令而非重启节点
2. upc命令中不允许role为all和bs,只允许searcher和qrs
  • Loading branch information
dyuyang authored Mar 22, 2023
1 parent 7a3c2e4 commit f5847f6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions hape/hape/commands/plan_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def _start(self, domain_name, roles, worker, build_index_name=None):
final_target = self._domain_heartbeat_service.read_worker_final_target(domain_name, role, worker)
user_target = final_target
user_target['type'] = Target.USER_TARGET_TYPE
user_target['user_cmd'] = HapeCommon.START_WORKER_COMMAND
self._domain_heartbeat_service.write_worker_user_target(domain_name, role, worker, user_target)

def _gen_start_target_role(self, domain_name, role_name, plan):
Expand Down Expand Up @@ -238,10 +239,10 @@ def upc(self, args):
parser = argparse.ArgumentParser()
required_group = parser.add_argument_group('required arguments')
required_group.add_argument('--config', type=str, dest='config', required=True, help="hape config path of havenask domain")
required_group.add_argument('--role', choices=["all", "bs", "searcher", "qrs"], dest='role', required=True, help="role in domain")
required_group.add_argument('--role', choices=["searcher", "qrs"], dest='role', required=True, help="role in domain")
self.args = parser.parse_args(args)
self.config = self.args.config
self.roles = [self.args.role] if self.args.role != 'all' else ["searcher", "qrs", "bs"]
self.roles = [self.args.role]
self.domain_name = self._strip_domain_name(self.config)
self.init_member(self.config)
self._upc(self.domain_name, self.roles)
Expand Down

0 comments on commit f5847f6

Please sign in to comment.