本文整理匯總了Python中MaKaC.plugins.PluginsHolder.reloadAllPlugins方法的典型用法代碼示例。如果您正苦於以下問題:Python PluginsHolder.reloadAllPlugins方法的具體用法?Python PluginsHolder.reloadAllPlugins怎麽用?Python PluginsHolder.reloadAllPlugins使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MaKaC.plugins.PluginsHolder
的用法示例。
在下文中一共展示了PluginsHolder.reloadAllPlugins方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: runTests
# 需要導入模塊: from MaKaC.plugins import PluginsHolder [as 別名]
# 或者: from MaKaC.plugins.PluginsHolder import reloadAllPlugins [as 別名]
def runTests(host='localhost', port=FAKE_SERVICE_PORT,
scenarios=[(2, 10)]):
execTimes = []
agent = InvenioBatchUploaderAgent('test1', 'test1', 'test',
0, 'http://%s:%s' \
% (host, port))
ph = PluginsHolder()
ph.reloadAllPlugins()
ph.getPluginType('livesync').toggleActive()
do = DummyObservable()
do._notify('updateDBStructures', 'indico.ext.livesync',
None, None, None)
sm = SyncManager.getDBInstance()
sm.registerNewAgent(agent)
cm = CategoryManager()
avatar = user.Avatar()
avatar.setName( "fake" )
avatar.setSurName( "fake" )
avatar.setOrganisation( "fake" )
avatar.setLang( "en_GB" )
avatar.setEmail( "[email protected]" )
#registering user
ah = user.AvatarHolder()
ah.add(avatar)
#setting up the login info
li = user.LoginInfo( "dummyuser", "dummyuser" )
ih = AuthenticatorMgr()
userid = ih.createIdentity( li, avatar, "Local" )
ih.add( userid )
#activate the account
avatar.activateAccount()
#since the DB is empty, we have to add dummy user as admin
minfo = HelperMaKaCInfo.getMaKaCInfoInstance()
al = minfo.getAdminList()
al.grant( avatar )
dummy = avatar
ContextManager.destroy()
HelperMaKaCInfo.getMaKaCInfoInstance().setDefaultConference(DefaultConference())
cm.getRoot()
do._notify('requestStarted')
home = cm.getById('0')
# execute code
for nconf in range(0, 1000):
conf = home.newConference(dummy)
conf.setTitle('Test Conference %s' % nconf)
do._notify('requestFinished')
time.sleep(1)
# params won't be used
task = LiveSyncUpdateTask(dateutil.rrule.MINUTELY)
for scen in scenarios:
print "Scenario %s workers, size = %s " % scen,
# configure scenario
InvenioBatchUploaderAgent.NUM_WORKERS = scen[0]
InvenioBatchUploaderAgent.BATCH_SIZE = scen[1]
ts = time.time()
# just run it
task.run()
te = time.time()
execTimes.append(te - ts)
print "%s" % (te - ts)
sm._track._pointers['test1'] = None
for i in range(0, len(execTimes)):
results[scenarios[i]] = execTimes[i]