当前位置: 首页>>代码示例>>Python>>正文


Python Scheduler.wake方法代码示例

本文整理汇总了Python中scheduler.Scheduler.wake方法的典型用法代码示例。如果您正苦于以下问题:Python Scheduler.wake方法的具体用法?Python Scheduler.wake怎么用?Python Scheduler.wake使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在scheduler.Scheduler的用法示例。


在下文中一共展示了Scheduler.wake方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: cmd_done

# 需要导入模块: from scheduler import Scheduler [as 别名]
# 或者: from scheduler.Scheduler import wake [as 别名]
 def cmd_done(cls, data):
     #print(data)
     agent_id = data['agent_id']
     cmd_spec = cls.running_cmds[agent_id]
     cmd_spec['exitcode'] = data['exitcode']
     cmd_spec['errmsg']   = data['errmsg']
     del cls.running_cmds[agent_id]
     cls.idle_agents.add(agent_id)
     Scheduler.wake(cls.agent_visitor[agent_id])
开发者ID:wehu,项目名称:pydv,代码行数:11,代码来源:job.py

示例2: run

# 需要导入模块: from scheduler import Scheduler [as 别名]
# 或者: from scheduler.Scheduler import wake [as 别名]
 def run(cls):
     if cls.jobengine_visitor:
         Scheduler.wake(cls.jobengine_visitor)
     else:
         cls.timer = Timer(cls.time_out, cls.agent_checker, args=(cls,))
         cls.timer.start()
         @visitor
         def body():
             try:
                 while True:
                     cls.process_msg()
                     while len(cls.cmds) > 0 and (len(cls.pending_cmds) + len(cls.running_cmds)) < cls.max_cmds:
                         v, cmd_spec = cls.cmds.pop()
                         agent_id = cls.get_agent(v);
                         cmd_spec['agent_id'] = agent_id
                         cls.pending_cmds[agent_id] = cmd_spec
                     yield from Scheduler.sleep()
             except Exception as e:
                 logger.error(e)
         cls.jobengine_visitor = body
开发者ID:wehu,项目名称:pydv,代码行数:22,代码来源:job.py

示例3: build_needs

# 需要导入模块: from scheduler import Scheduler [as 别名]
# 或者: from scheduler.Scheduler import wake [as 别名]
    def build_needs(self):
        n = self.node
        cv = Scheduler.current
        if n.color == 'black':
            return
        
        sg = needgraph.subgraph(n)
        for i in self.needs:
            if i.node.color == 'gray':
                i.add_waiter(n)
                n.wait_on.add(i.node)
                sg.remove_node(i.node)
                ssg = needgraph.subgraph(i.node)
                for j in ssg.nodes_iter():
                    sg.remove_node(j)
                    
        for i in sg.nodes_iter():
            if not i.color == 'black':
                i.color = 'gray'

        ns = set()
        def collect_nodes():
            for i in sg.nodes_iter():
                if sg.out_degree(i) == 0 and not i.color == 'black':
                    ns.add(i.ntt)
        collect_nodes()
        try:
            while len(ns) > 0:
                @join
                def body(s):
                    for i in ns:
                        @spawn(s)
                        def f(ii=i):
                            try:
                                yield from ii.build()
                            finally:
                                ii.node.color = 'black'
                                ns.remove(ii)
                                if sg.has_node(ii.node):
                                    sg.remove_node(ii.node)
                yield from body()
                collect_nodes()
            
            while len(n.wait_on) > 0:
                yield from Scheduler.sleep()

        except Exception as e:
            cv.exception = e
            for i in sg.nodes_iter():
                i.color = 'black'
                for j in i.waiter_nodes:
                    j.wait_on.remove(i)
                for v in i.waiters:
                    v.exception = cv.exception
                    Scheduler.wake(v)

        n.color = 'black'
            
        for i in n.waiter_nodes:
            i.wait_on.remove(n)

        for v in n.waiters:
            if cv.exception:
                v.exception = cv.exception
            Scheduler.wake(v)
            
        n.waiters.clear()
        n.waiter_nodes.clear()

        if cv.exception:
            raise cv.exception
开发者ID:wehu,项目名称:pydv,代码行数:73,代码来源:entity.py

示例4: wake_waiters

# 需要导入模块: from scheduler import Scheduler [as 别名]
# 或者: from scheduler.Scheduler import wake [as 别名]
 def wake_waiters(self):
     for v in self.node.waiters:
         Scheduler.wake(v)
开发者ID:wehu,项目名称:pydv,代码行数:5,代码来源:entity.py


注:本文中的scheduler.Scheduler.wake方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。