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


Python Scheduler.join方法代码示例

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


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

示例1: nda_loop

# 需要导入模块: from scheduler import Scheduler [as 别名]
# 或者: from scheduler.Scheduler import join [as 别名]
def nda_loop():
	ndutil.setTimezone()

	ndlCom = NdlCom('nDroid-Executer', '127.0.0.1', 12322)
	ndlCom.doCom('Initiating')

	ndlCom.doCom('Loading Config')
	cnfManager = CnfManager()
	cnfManager.load('./nde.cnf')
	cnfData = cnfManager.getCnfData()

	nsQueue = Queue()
	nsLock = threading.Lock()

	netManager = NetManager()
	netManager.setNdlCom(ndlCom)
	netManager.setNsQueue(nsQueue, nsLock)

	ndlCom.doCom('Starting Threads')
	scheduler = Scheduler([ndlCom, nsQueue, nsLock], 'Scheduler')

	scheduler.start()

	reactor.listenUDP(cnfData['comPort'], netManager)
	ndlCom.doCom('Listening Com Port')
	reactor.run()

	scheduler.join()
开发者ID:jovistar,项目名称:nDroid-Executer,代码行数:30,代码来源:nde.py

示例2: main

# 需要导入模块: from scheduler import Scheduler [as 别名]
# 或者: from scheduler.Scheduler import join [as 别名]
def main():
    tasksq = multiprocessing.Queue()
    mgr = multiprocessing.Manager()
    e = mgr.Event()


    scheduler = Scheduler(e, tasksq)               # Reads the probs to be executed and queues in tasksq
    dispatcher = Dispatcher(tasksq)
    o = Oscillator(e, 1)                                    # TODO: this should be a configuration
    o.start()
    scheduler.start()
    dispatcher.start()
    o.join()
    scheduler.join()
开发者ID:karthikrev,项目名称:ThePyMonitor,代码行数:16,代码来源:pymonitor.py

示例3: main

# 需要导入模块: from scheduler import Scheduler [as 别名]
# 或者: from scheduler.Scheduler import join [as 别名]
def main():
	print 'Welcome to WLSF-OS, made in Python by Capy Solutions'
	n_cores = int(raw_input('Enter the amount of cores you gonna use: '))
	quantum = int(raw_input('Enter the quantum time for the cores(Round-Robin preemptive): '))
	n_processes = int(raw_input('Enter the amount of process you wanna create: '))

	cores = [Core(quantum) for i in range(n_cores)]
	processes = deque(Process() for i in range(n_processes))

	scheduler = Scheduler(cores, processes)
	scheduler.setup()

	scheduler.start()

	scheduler.join()
开发者ID:WLSF,项目名称:os-scheduler-simulator,代码行数:17,代码来源:main.py

示例4: print

# 需要导入模块: from scheduler import Scheduler [as 别名]
# 或者: from scheduler.Scheduler import join [as 别名]
import json
import uuid
from scheduler import Scheduler

if __name__ == '__main__':
    from kazoo.client import KazooClient
    import sys
    task = {
        'job_id': 'test'
    }
    task_id = uuid.uuid4().hex
    print(task_id)
    target = 'test'
    zk = KazooClient()
    zk.start()
    zk.ensure_path('/msched/agents/{0}/tasks'.format(target))
    zk.ensure_path('/msched/tasks/{0}'.format(task_id))
    zk.set('/msched/tasks/{0}'.format(task_id), json.dumps(task).encode())
    zk.ensure_path('/msched/tasks/{0}/targets/{1}'.format(task_id, target))
    zk.set('/msched/tasks/{0}/targets/{1}'.format(task_id, target), b'N')
    zk.ensure_path('/msched/signal/{0}'.format(task_id))
    if len(sys.argv) >= 1:
        sys.exit()
    sched = Scheduler(zk, 'msched')
    sched.watch()
    try:
        sched.join()
    except KeyboardInterrupt:
        sched.shutdown()

开发者ID:hulaoan,项目名称:msched,代码行数:31,代码来源:sched.py

示例5: getInstance

# 需要导入模块: from scheduler import Scheduler [as 别名]
# 或者: from scheduler.Scheduler import join [as 别名]

#.........这里部分代码省略.........
			self.__listeners.remove(listener)

	## Events

	def notifyTaskDone(self, task):
		for listener in self.__listeners:
			listener.onTaskDone(task)
			
	def notifyTaskProgress(self, task, progress):
		for listener in self.__listeners:
			listener.onTaskProgress(task, progress)

	def notifyTaskCancel(self, task):
		for listener in self.__listeners:
			listener.onTaskCancel(task)
			
	def notifyTaskSuspended(self, task):
		for listener in self.__listeners:
			listener.onTaskSuspended(task)

	def notifyTaskResumed(self, task):
		for listener in self.__listeners:
			listener.onTaskResumed(task)

	def notifyTaskError(self, task):
		for listener in self.__listeners:
			listener.onTaskError(task)

	## Task management

	def queueTask(self, task):
		self.__scheduler.queueTask(task)

	def __registerTask(self, task):
		if task.uuid not in self.__tasks:
			self.__tasks[task.uuid] = TaskRef(task)

	def upload(self, filename):
		t = UpTask(self, filename)
		self.__registerTask(t)
		return t.uuid
		
	def download(self, url, prefix=''):
		t = DownTask(self, url, prefix)
		self.__registerTask(t)
		return t.uuid
		
	def startTask(self, task):
		if task in self.__tasks:
			self.__tasks[task].object.process()

	def removeTask(self, task):
		if task in self.__tasks:
			self.__tasks[task].cancel()
			del self.__tasks[task]
			
	def suspendTask(self, task):
		if task in self.__tasks:
			self.__tasks[task].suspend()
			
	def resumeTask(self, task):
		if task in self.__tasks:
			self.__tasks[task].resume()		

	def getTaskStatus(self, task):
		if task in self.__tasks:
			return self.__tasks[task].status

	def getTask(self, task):
		if task in self.__tasks:
			return self.__tasks[task]
		else:
			return None

	def cancel(self, task):
		if task in self.__tasks:
			self.__tasks[task].cancel()
		self.notifyTaskCancel(task)

	def shutdown(self):
		self.__scheduler.cancel()
		self.__scheduler.join()


	## Events
		
	def onTaskDone(self, task):
		if task.uuid in self.__tasks:
			self.__tasks[task.uuid].status=TaskStatus.TASK_DONE
			self.notifyTaskDone(task.uuid)
			
	def onTaskError(self, task):
		if task.uuid in self.__tasks:
			self.__tasks[task.uuid].status=TaskStatus.TASK_ERR
			self.notifyTaskError(task.uuid)
			
	def onTaskProgress(self, task, done, total):
		if task.uuid in self.__tasks:
			self.__tasks[task.uuid].update(done, total)
			self.notifyTaskProgress(task.uuid,float(done)/total)
开发者ID:mattoufoutu,项目名称:Vodstok,代码行数:104,代码来源:manager.py

示例6: define

# 需要导入模块: from scheduler import Scheduler [as 别名]
# 或者: from scheduler.Scheduler import join [as 别名]
import os
from tornado.options import options, define, parse_command_line, parse_config_file
from scheduler import Scheduler

define('hosts', default='127.0.0.1:2181', type=str, help='zookeeper hosts')
define('root', default='/msched', type=str, help='zookeeper root node')

if __name__ == '__main__':
    if os.path.exists('/etc/msched/scheduler.conf'):
        parse_config_file('/etc/msched/scheduler.conf')
    if os.path.exists('./application.conf'):
        parse_config_file('./application.conf')
    parse_command_line()
    scheduler = Scheduler(hosts=options.hosts, root=options.root)
    scheduler.start()
    try:
        scheduler.join()
    except KeyboardInterrupt:
        scheduler.shutdown()
开发者ID:hulaoan,项目名称:msched,代码行数:21,代码来源:application.py


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