當前位置: 首頁>>代碼示例>>Python>>正文


Python DataBuilder.get_schedules方法代碼示例

本文整理匯總了Python中pinball.ui.data_builder.DataBuilder.get_schedules方法的典型用法代碼示例。如果您正苦於以下問題:Python DataBuilder.get_schedules方法的具體用法?Python DataBuilder.get_schedules怎麽用?Python DataBuilder.get_schedules使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pinball.ui.data_builder.DataBuilder的用法示例。


在下文中一共展示了DataBuilder.get_schedules方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _compute_workflow

# 需要導入模塊: from pinball.ui.data_builder import DataBuilder [as 別名]
# 或者: from pinball.ui.data_builder.DataBuilder import get_schedules [as 別名]
def _compute_workflow(dbstore):
    """Cache thread's target callable that computes the workflow.

    This runnable is called my thread's run() method when thread
    starts. It will compute workflows data, serialize it, and store it
    in _WORKFLOW_JSON. This computation will infinitely
    repeat itself, constantly updating the _WORKFLOW_JSON until pinball_ui
    server stops.

    Args:
        dbstore: The store to retrieve runs status.
    """
    global _WORKFLOWS_JSON
    data_builder = DataBuilder(dbstore, use_cache=True)
    while True:
        try:
            LOG.info("Workflow data computation starting.")
            workflows_data = data_builder.get_workflows()
            schedules_data = data_builder.get_schedules()
            _WORKFLOWS_JSON = _serialize(workflows_data, schedules_data)
            LOG.info("Workflow data computation complete.")
            # TODO(mao): Tune this parameter depending on future
            # pinball user experience.
            # TODO(mao): Make this computation run at scheduled time intervals
            # and cancel the next execution if the previous job hasn't
            # finished.
            time.sleep(60 * 20)
        except Exception as e:
            LOG.exception(e)
開發者ID:Betterment,項目名稱:pinball,代碼行數:31,代碼來源:cache_thread.py

示例2: schedules

# 需要導入模塊: from pinball.ui.data_builder import DataBuilder [as 別名]
# 或者: from pinball.ui.data_builder.DataBuilder import get_schedules [as 別名]
def schedules(_):
    try:
        data_builder = DataBuilder(DbStore())
        schedules_data = data_builder.get_schedules()
        schedules_json = _serialize(schedules_data)
    except:
        LOG.exception('')
        return HttpResponseServerError(traceback.format_exc())
    else:
        return HttpResponse(schedules_json, mimetype='application/json')
開發者ID:DotModus,項目名稱:pinball,代碼行數:12,代碼來源:views.py


注:本文中的pinball.ui.data_builder.DataBuilder.get_schedules方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。