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


Python Job.queue方法代码示例

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


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

示例1: __queue__

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import queue [as 别名]
 def __queue__(self):
     ''' Starts a job or leaves it in the queue (thread safe) '''
     logging.debug("Attempting to acquire queue mutex ...")
     self.mutex.acquire()
     logging.debug("Successfully acquired queue mutex.")
     queue = list(Job.queue())  # Create a copy of the queue
     for job in queue:
         logging.info("Dispatching job: %s" % job.job_name)
         if len(job) == 0:
             job.status = u"COMPLETED"
             dbsession.add(job)
             dbsession.flush()
         else:
             algo = Algorithm.by_id(job.algorithm_id)
             weapon_systems = WeaponSystem.system_ready(algo)
             if weapon_systems is not None and 0 < len(weapon_systems):
                 logging.info("Weapon systems available: %d" % (
                     len(weapon_systems),
                 ))
                 thread.start_new_thread(
                     self.__crack__, 
                     (job, weapon_systems[0],)
                 )
             else:
                 logging.info("No available weapon systems at this time.")
     self.mutex.release()
开发者ID:DJHartley,项目名称:The-Planetary-Assault-System,代码行数:28,代码来源:Dispatch.py

示例2: check_queue

# 需要导入模块: from models import Job [as 别名]
# 或者: from models.Job import queue [as 别名]
 def check_queue(self):
     ''' Starts a job or leaves it in the queue (thread safe) '''
     self.mutex.acquire()
     queue = list(Job.queue())  # Create a copy of the queue
     for job in queue:
         if len(job) == 0:
             job.status = u"COMPLETED"
             dbsession.add(job)
             dbsession.flush()
         else:
             weapon_systems = WeaponSystem.ready_system(
                 job.hashes[0].algorithm)
             if weapon_systems != None and 0 < len(weapon_systems):
                 thread.start_new_thread(
                     self.__crack__, (job, weapon_systems[0],))
     self.mutex.release()
开发者ID:brutalhonesty,项目名称:The-Planetary-Assault-System,代码行数:18,代码来源:Dispatch.py


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