def __init__(self, hooks=None):
     current_env().sess_start()
     self._hooks = [] if hooks is None else hooks
     reader_hooks = get_collection(READER_HOOKS)
     if reader_hooks is not None:
         self._hooks.extend(reader_hooks)
     self._cur_scope = cur_model_scope()
     self._session = SimpleSession(hooks)
     self._finish = False
示例#2
0
 def __init__(self, hooks=None):
     env = current_env()
     if env is None:
         self._is_chief = True
     else:
         self._is_chief = env.is_chief
     if hooks is None:
         hooks = []
     self._hooks = hooks
     if self._is_chief:
         self._hooks = [ChiefHook(), WorkerHook()] + self._hooks
     else:
         self._hooks = [WorkerHook()] + self._hooks
     self._session = Session(self._hooks)
 def __init__(self, hooks=None):
     env = current_env()
     if env is None:
         self._is_chief = True
     else:
         self._is_chief = env.is_chief
     if hooks is None:
         hooks = []
     self._hooks = hooks
     if self._is_chief:
         #self._hooks = self._hooks + [ChiefHook(), WorkerHook()]
         self._hooks = self._hooks + [ChiefHook()]
     else:
         self._hooks = self._hooks + [WorkerHook()]
     def take_priority(elem):
         return elem._priority
     self._hooks.sort(key=take_priority)
     self._session = Session(self._hooks)
示例#4
0
 def __init__(self, hooks=None):
     current_env().sess_start()
     self._hooks = hooks
     self._session = SimpleSession(hooks)
     self._finish = False