本文整理汇总了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()
示例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()
示例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()
示例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()
示例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)
示例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()