Skip to content

Commit 37d5dc2

Browse files
huijunwunwangtw
authored andcommitted
keep executor running when heron update adds containers (apache#3162)
* fix_executor_assert * add_method_doc
1 parent 1c0f161 commit 37d5dc2

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

heron/executor/src/python/heron_executor.py

+18-2
Original file line numberDiff line numberDiff line change
@@ -844,8 +844,11 @@ def _get_instance_plans(self, packing_plan, container_id):
844844
if container_plan.id == container_id:
845845
this_container_plan = container_plan
846846

847-
# make sure that our shard id is a valid one
848-
assert this_container_plan is not None
847+
# When the executor runs in newly added container by `heron update`,
848+
# there is no plan for this container. In this situation,
849+
# return None to bypass instance processes.
850+
if this_container_plan is None:
851+
return None
849852
return this_container_plan.instance_plans
850853

851854
# Returns the common heron support processes that all containers get, like the heron shell
@@ -973,9 +976,22 @@ def start_process_monitor(self):
973976
log_pid_for_process(name, p.pid)
974977

975978
def get_commands_to_run(self):
979+
"""
980+
Prepare either TMaster or Streaming commands according to shard.
981+
The Shell command is attached to all containers. The empty container plan and non-exist
982+
container plan are bypassed.
983+
"""
976984
# During shutdown the watch might get triggered with the empty packing plan
977985
if len(self.packing_plan.container_plans) == 0:
978986
return {}
987+
if self._get_instance_plans(self.packing_plan, self.shard) is None and self.shard != 0:
988+
retval = {}
989+
retval['heron-shell'] = [
990+
'%s' % self.heron_shell_binary,
991+
'--port=%s' % self.shell_port,
992+
'--log_file_prefix=%s/heron-shell-%s.log' % (self.log_dir, self.shard),
993+
'--secret=%s' % self.topology_id]
994+
return retval
979995

980996
if self.shard == 0:
981997
commands = self._get_tmaster_processes()

0 commit comments

Comments
 (0)