本文整理汇总了Python中pykolab.auth.Auth.synchronize方法的典型用法代码示例。如果您正苦于以下问题:Python Auth.synchronize方法的具体用法?Python Auth.synchronize怎么用?Python Auth.synchronize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pykolab.auth.Auth
的用法示例。
在下文中一共展示了Auth.synchronize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: execute
# 需要导入模块: from pykolab.auth import Auth [as 别名]
# 或者: from pykolab.auth.Auth import synchronize [as 别名]
def execute(*args, **kw):
auth = Auth()
log.debug(_("Listing domains..."), level=5)
start_time = time.time()
domains = auth.list_domains()
end_time = time.time()
log.debug(
_("Found %d domains in %d seconds") % (
len(domains),
(end_time-start_time)
),
level=8
)
all_folders = []
for primary_domain,secondary_domains in domains:
log.debug(_("Running for domain %s") % (primary_domain), level=8)
auth.connect(primary_domain)
start_time = time.time()
auth.synchronize()
end_time = time.time()
log.info(_("Synchronizing users for %s took %d seconds")
% (primary_domain, (end_time-start_time))
)
示例2: execute
# 需要导入模块: from pykolab.auth import Auth [as 别名]
# 或者: from pykolab.auth.Auth import synchronize [as 别名]
def execute(*args, **kw):
global imap, pool
auth = Auth()
log.debug(_("Listing domains..."), level=5)
start_time = time.time()
domains = auth.list_domains()
end_time = time.time()
log.debug(
_("Found %d domains in %d seconds") % (
len(domains),
(end_time-start_time)
),
level=8
)
if version.StrictVersion(sys.version[:3]) >= version.StrictVersion("2.7"):
pool = multiprocessing.Pool(conf.threads, worker_process, (), 1)
else:
pool = multiprocessing.Pool(conf.threads, worker_process, ())
for primary_domain in list(set(domains.values())):
log.debug(_("Running for domain %s") % (primary_domain), level=8)
auth = Auth(primary_domain)
auth.connect(primary_domain)
start_time = time.time()
auth.synchronize(mode='_paged_search', callback=queue_add)
end_time = time.time()
log.info(_("Synchronizing users for %s took %d seconds")
% (primary_domain, (end_time-start_time))
)
while not pool._taskqueue.empty():
time.sleep(1)
示例3: synchronize
# 需要导入模块: from pykolab.auth import Auth [as 别名]
# 或者: from pykolab.auth.Auth import synchronize [as 别名]
def synchronize(self, domain):
sync_interval = conf.get('kolab', 'sync_interval')
if sync_interval == None or sync_interval == 0:
sync_interval = 300
else:
sync_interval = (int)(sync_interval)
while True:
try:
auth = Auth(domain)
auth.connect(domain)
auth.synchronize()
time.sleep(sync_interval)
except KeyboardInterrupt:
break
except Exception, errmsg:
log.error(_("Error in process %r, terminating: %r") % (self.name, errmsg))
import traceback
traceback.print_exc()
time.sleep(1)
示例4: synchronize_once
# 需要导入模块: from pykolab.auth import Auth [as 别名]
# 或者: from pykolab.auth.Auth import synchronize [as 别名]
def synchronize_once():
auth = Auth()
auth.connect()
auth.synchronize(mode='_paged_search')