示例#1
0
文件: execute.py 项目: ooici/eeagent
    def __init__(self, eeagent_cfg, pyon_container, log=logging):
        self.log = log
        self.log.debug("Starting PyonExe")
        self._eename = eeagent_cfg.name
        self._slots = int(eeagent_cfg.slots)
        self._working_dir = eeagent_cfg.launch_type.persistence_directory
        self._known_pws = {}

        from pidantic.pyon.pidpyon import PyonPidanticFactory
        self._factory = PyonPidanticFactory(pyon_container=pyon_container,
                                            name=self._eename,
                                            directory=self._working_dir,
                                            log=self.log)

        pidantic_instances = self._factory.reload_instances()
        if len(pidantic_instances.keys()) > 0:
            self.log.error("Restarting eeagent, and found dead processes: %s" %
                           ','.join(pidantic_instances.keys()))

        for name, pidantic in pidantic_instances.iteritems():
            upid = pidantic.get_name()
            pw = PidWrapper(self, upid)
            pw.set_pidantic(pidantic)
            self._known_pws[upid] = pw
        self._state_change_cb = None
        self._state_change_cb_arg = None