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


Python Component.__setstate__方法代码示例

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


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

示例1: __setstate__

# 需要导入模块: from Cobalt.Components.base import Component [as 别名]
# 或者: from Cobalt.Components.base.Component import __setstate__ [as 别名]
    def __setstate__(self, state):
        Component.__setstate__(self, state)

        self.reservations = state['reservations']
        if 'active' in state:
            self.active = state['active']
        else:
            self.active = True
        
        self.id_gen = IncrID()
        self.id_gen.set(state['next_res_id'])
        global bgsched_id_gen
        bgsched_id_gen = self.id_gen
        
        self.cycle_id_gen = IncrID()
        self.cycle_id_gen.set(state['next_cycle_id'])
        global bgsched_cycle_id_gen
        bgsched_cycle_id_gen = self.cycle_id_gen

        self.queues = QueueDict()
        self.jobs = JobDict()
        self.started_jobs = {}
        self.sync_state = Cobalt.Util.FailureMode("Foreign Data Sync")
        
        self.get_current_time = time.time

        if state.has_key('msg_queue'):
            dbwriter.msg_queue = state['msg_queue']
        if state.has_key('overflow') and (dbwriter.max_queued != None):
            dbwriter.overflow = state['overflow']
开发者ID:ido,项目名称:cobalt-svn-old,代码行数:32,代码来源:bgsched.py

示例2: __setstate__

# 需要导入模块: from Cobalt.Components.base import Component [as 别名]
# 或者: from Cobalt.Components.base.Component import __setstate__ [as 别名]
   def __setstate__(self, state):
      Component.__setstate__(self, state)

      self.msg_queue = state['msg_queue']
      self.connected = False
      self.decoder = LogMessageDecoder()
      self.clearing_overflow = False
      self.overflow_filename = None
      self.overflow_file = None
      self.max_queued = int(get_cdbwriter_config('max_queued_msgs', '-1'))
                        
      if self.max_queued <= 0:
         logger.info("message queue set to unlimited.")
         self.max_queued = None
      else:
         self.overflow_filename = get_cdbwriter_config('overflow_file', None)

      if self.max_queued and (self.overflow_filename == None):
         logger.warning("No file given to catch maximum messages. Setting queue size to unlimited.")
         self.max_queued = None

      if state.has_key('overflow') and self.max_queued:
         self.overflow = state['overflow']
      else:
         self.overflow = False
开发者ID:ido,项目名称:cobalt-svn-old,代码行数:27,代码来源:cdbwriter.py

示例3: __setstate__

# 需要导入模块: from Cobalt.Components.base import Component [as 别名]
# 或者: from Cobalt.Components.base.Component import __setstate__ [as 别名]
    def __setstate__(self, state):
        Component.__setstate__(self, state)

        self.queue_assignments = state["queue_assignments"]
        self.down_nodes = state["down_nodes"]

        self.process_groups = ProcessGroupDict()
        self.all_nodes = set()
        self.running_nodes = set()
        self.node_order = {}
        try:
            self.configure(cluster_hostfile)
        except:
            self.logger.error("unable to load hostfile")
        self.alloc_only_nodes = {} # nodename:starttime
        if not state.has_key("cleaning_processes"):
            self.cleaning_processes = []
        self.cleaning_host_count = {} # jobid:count
        self.locations_by_jobid = {} #jobid:[locations]
        self.jobid_to_user = {} #jobid:username

        self.alloc_timeout = int(get_cluster_system_config("allocation_timeout", 300))
        self.logger.info("allocation timeout set to %d seconds." % self.alloc_timeout)
开发者ID:ido,项目名称:cobalt-svn-old,代码行数:25,代码来源:cluster_base_system.py

示例4: __setstate__

# 需要导入模块: from Cobalt.Components.base import Component [as 别名]
# 或者: from Cobalt.Components.base.Component import __setstate__ [as 别名]
 def __setstate__(self, state):
     Component.__setstate__(self, state)
开发者ID:benmcclelland,项目名称:cobalt-orcm,代码行数:4,代码来源:slp.py


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