提交 a58df687 编写于 作者: D dongdaxiang

only allow fleet to be initialized once

上级 3e38d1db
...@@ -29,14 +29,17 @@ class Fleet(object): ...@@ -29,14 +29,17 @@ class Fleet(object):
self._opt_info = None # for fleet only self._opt_info = None # for fleet only
self.role_maker_ = None self.role_maker_ = None
self.local_ip_ = 0 self.local_ip_ = 0
self.is_initialized_ = False
def init(self): def init(self):
# TODO(guru4elephant) # TODO(guru4elephant)
# this is a temporary solution # this is a temporary solution
# we will support more configurable RoleMaker for users in the future # we will support more configurable RoleMaker for users in the future
if not self.is_initialized_:
self.role_maker_ = MPISymetricRoleMaker() self.role_maker_ = MPISymetricRoleMaker()
self.role_maker_.generate_role() self.role_maker_.generate_role()
self._fleet_ptr = fluid.core.Fleet() self._fleet_ptr = fluid.core.Fleet()
self.is_initialized_ = True
def stop(self): def stop(self):
self.role_maker_.barrier_worker() self.role_maker_.barrier_worker()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册