• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python misc.walltime函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python misc.encode_response函数代码示例发布时间:2022-05-27
下一篇:
Python authn_context.AuthnBroker类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap