Esempio n. 1
0
 def collectively_restart_shard(self, state, host_recipients, agent_id, monitor):
     task = getattr(state, "restart_shard_task", None)
     if task is None or task.finished():
         state.restart_shard_task = state.medium.initiate_protocol(
             problem.CollectiveSolver, RestartShard(self, agent_id, monitor), host_recipients
         )
     return state.restart_shard_task
Esempio n. 2
0
 def _unregister_task(self, state, agent_id):
     task = state.handler_tasks.pop(agent_id, None)
     if task is None or not task.finished():
         self.warning('In _unregister_task(). Expected to get the '
                      'finished task instance, got %r instead.', task)
Esempio n. 3
0
 def wait_for_shard_restart(self, state):
     task = getattr(state, 'restart_shard_task', None)
     if task is None or task.finished():
         return fiber.succeed(state.partners.shard)
     else:
         return self.wait_for_event('shard_agent_restarted')