本文整理汇总了Python中sagenb.misc.misc.walltime函数的典型用法代码示例。如果您正苦于以下问题:Python walltime函数的具体用法?Python walltime怎么用?Python walltime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了walltime函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: init_updates
def init_updates():
global save_interval, idle_interval, last_save_time, last_idle_time
from sagenb.misc.misc import walltime
save_interval = notebook.conf()['save_interval']
idle_interval = notebook.conf()['idle_check_interval']
last_save_time = walltime()
last_idle_time = walltime()
开发者ID:lukas-lansky,项目名称:sagenb,代码行数:8,代码来源:base.py
示例2: notebook_idle_check
def notebook_idle_check(self):
t = walltime()
if t > self.last_idle_time + self.idle_interval:
if t > self.last_idle_time + self.idle_interval:
self.notebook.update_worksheet_processes()
self.notebook.quit_idle_worksheet_processes()
self.last_idle_time = t
开发者ID:rljacobson,项目名称:Guru-NB,代码行数:8,代码来源:WorksheetController.py
示例3: notebook_save_check
def notebook_save_check():
global last_save_time
from sagenb.misc.misc import walltime
t = walltime()
if t > last_save_time + save_interval:
notebook.save()
last_save_time = t
开发者ID:jasongrout,项目名称:sagenb-flask,代码行数:8,代码来源:base.py
示例4: _check_for_walltimeout
def _check_for_walltimeout(self):
"""
Check if the walltimeout has been reached, and if so, kill
this worksheet process.
"""
if (self._is_started and \
self._max_walltime and self._start_walltime and \
walltime() - self._start_walltime > self._max_walltime):
self.quit()
开发者ID:TIMMYD3,项目名称:sagenb,代码行数:9,代码来源:expect.py
示例5: notebook_idle_check
def notebook_idle_check():
global last_idle_time
from sagenb.misc.misc import walltime
t = walltime()
if t > last_idle_time + idle_interval:
notebook.update_worksheet_processes()
notebook.quit_idle_worksheet_processes()
last_idle_time = t
开发者ID:jasongrout,项目名称:sagenb-flask,代码行数:9,代码来源:base.py
示例6: start
def start(self):
"""
Start this worksheet process running.
"""
self._expect = pexpect.spawn(self.command())
self._is_started = True
self._is_computing = False
self._number = 0
self._read()
self._start_walltime = walltime()
开发者ID:TIMMYD3,项目名称:sagenb,代码行数:10,代码来源:expect.py
示例7: test_allpub
def test_allpub(self):
"""
View every single one of the published worksheets on the
FEMhub online lab server.
"""
if self._verbose: print "testing download of all published worksheets..."
tm = walltime()
pub = self.get_urls_of_published_worksheets()
try:
alarm(self._url_timeout)
for i, X in enumerate(pub):
t0 = walltime()
self._geturl(X, use_alarm=False)
if self._verbose:
print "Got %s [%s/%s] %.2f seconds"%(X,i+1,len(pub), walltime(t0))
return walltime(tm)
except KeyboardInterrupt:
return TIMEOUT
finally:
cancel_alarm()
开发者ID:regmi,项目名称:femhub-lab,代码行数:20,代码来源:stress.py
示例8: notebook_save_check
def notebook_save_check(self):
t = walltime()
if t > self.last_save_time + self.save_interval:
with global_lock:
# if someone got the lock before we did, they might have saved,
# so we check against the last_save_time again
# we don't put the global_lock around the outer loop since we don't need
# it unless we are actually thinking about saving.
if t > self.last_save_time + self.save_interval:
self.notebook.save()
self.last_save_time = t
开发者ID:rljacobson,项目名称:Guru-NB,代码行数:11,代码来源:WorksheetController.py
示例9: download_worksheets
def download_worksheets():
from sagenb.misc.misc import walltime, tmp_filename
t = walltime()
print "Starting zipping a group of worksheets in a separate thread..."
zip_filename = tmp_filename() + ".zip"
# child
worksheet_names = set()
if 'filenames' in request.values:
import json
filenames = json.loads(request.values['filenames'])
worksheets = [g.notebook.get_worksheet_with_filename(x.strip())
for x in filenames if len(x.strip()) > 0]
else:
worksheets = g.notebook.worksheet_list_for_user(g.username)
import zipfile
zip = zipfile.ZipFile(zip_filename, 'w', zipfile.ZIP_STORED)
for worksheet in worksheets:
sws_filename = tmp_filename() + '.sws'
g.notebook.export_worksheet(worksheet.filename(), sws_filename)
entry_name = worksheet.name()
if entry_name in worksheet_names:
i = 2
while ("%s_%s" % (entry_name, i)) in worksheet_names:
i += 1
entry_name = "%s_%s" % (entry_name, i)
zip.write(sws_filename, entry_name + ".sws")
os.unlink(sws_filename)
zip.close()
r = open(zip_filename, 'rb').read()
os.unlink(zip_filename)
print "Finished zipping %s worksheets (%s seconds)"%(len(worksheets), walltime(t))
response = current_app.make_response(r)
response.headers['Content-Type'] = 'application/zip'
return response
开发者ID:SnarkBoojum,项目名称:sagenb,代码行数:38,代码来源:worksheet_listing.py
示例10: notebook_save_check
def notebook_save_check():
global last_save_time
from sagenb.misc.misc import walltime
t = walltime()
if t > last_save_time + save_interval:
with global_lock:
# if someone got the lock before we did, they might have saved,
# so we check against the last_save_time again
# we don't put the global_lock around the outer loop since we don't need
# it unless we are actually thinking about saving.
if t > last_save_time + save_interval:
notebook.save()
last_save_time = t
开发者ID:lukas-lansky,项目名称:sagenb,代码行数:14,代码来源:base.py
示例11: notebook_idle_check
def notebook_idle_check():
global last_idle_time
from sagenb.misc.misc import walltime
t = walltime()
if t > last_idle_time + idle_interval:
with global_lock:
# if someone got the lock before we did, they might have already idled,
# so we check against the last_idle_time again
# we don't put the global_lock around the outer loop since we don't need
# it unless we are actually thinking about quitting worksheets
if t > last_idle_time + idle_interval:
notebook.update_worksheet_processes()
notebook.quit_idle_worksheet_processes()
last_idle_time = t
开发者ID:lukas-lansky,项目名称:sagenb,代码行数:16,代码来源:base.py
示例12: init_updates
def init_updates(self):
self.save_interval = self.notebook.conf()['save_interval']
self.idle_interval = self.notebook.conf()['idle_check_interval']
self.last_save_time = walltime()
self.last_idle_time = walltime()
开发者ID:rljacobson,项目名称:Guru-NB,代码行数:5,代码来源:WorksheetController.py
注:本文中的sagenb.misc.misc.walltime函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论