当前位置: 首页>>代码示例>>Python>>正文


Python ModelMeta.session_end方法代码示例

本文整理汇总了Python中solar.dblayer.model.ModelMeta.session_end方法的典型用法代码示例。如果您正苦于以下问题:Python ModelMeta.session_end方法的具体用法?Python ModelMeta.session_end怎么用?Python ModelMeta.session_end使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在solar.dblayer.model.ModelMeta的用法示例。


在下文中一共展示了ModelMeta.session_end方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: wait_finish

# 需要导入模块: from solar.dblayer.model import ModelMeta [as 别名]
# 或者: from solar.dblayer.model.ModelMeta import session_end [as 别名]
def wait_finish(uid, timeout):
    """Check if graph is finished

    Will return when no PENDING or INPROGRESS otherwise yields summary
    """
    start_time = time.time()

    while start_time + timeout >= time.time():
        dg = get_graph(uid)
        summary = Counter()
        summary.update({s.name: 0 for s in states})
        summary.update([task.status for task in dg.nodes()])
        yield summary
        if summary[states.PENDING.name] + summary[states.INPROGRESS.name] == 0:
            return
        else:
            # on db backends with snapshot isolation level and higher
            # updates wont be visible after start of transaction,
            # in order to report state correctly we will "refresh" transaction
            ModelMeta.session_end()
            ModelMeta.session_start()

    else:
        raise errors.ExecutionTimeout(
            'Run %s wasnt able to finish' % uid)
开发者ID:openstack,项目名称:solar,代码行数:27,代码来源:graph.py

示例2: test_concurrent_sequences_with_no_handler

# 需要导入模块: from solar.dblayer.model import ModelMeta [as 别名]
# 或者: from solar.dblayer.model.ModelMeta import session_end [as 别名]
def test_concurrent_sequences_with_no_handler(scale, clients):
    total_resources = scale * 3
    timeout = scale * 2
    scheduler_client = clients['scheduler']

    assert len(change.staged_log()) == total_resources
    ModelMeta.session_end()
    plan = change.send_to_orchestration()
    scheduler_client.next({}, plan.graph['uid'])

    def wait_function(timeout):
        try:
            for summary in wait_finish(plan.graph['uid'], timeout):
                assert summary[states.ERROR.name] == 0
                time.sleep(0.5)
        except ExecutionTimeout:
            pass
        return summary
    waiter = gevent.spawn(wait_function, timeout)
    waiter.join(timeout=timeout)
    res = waiter.get(block=True)
    assert res[states.SUCCESS.name] == total_resources
    assert len(data.CL()) == total_resources
    clear_cache()
    assert len(change.staged_log()) == 0
开发者ID:loles,项目名称:solar-1,代码行数:27,代码来源:test_complete_solar_workflow.py

示例3: _end_start_session

# 需要导入模块: from solar.dblayer.model import ModelMeta [as 别名]
# 或者: from solar.dblayer.model.ModelMeta import session_end [as 别名]
 def _end_start_session(cls, uid, identity):
     """Because of isolated versions of data in concurrent sessions
     we need to ensure that session will be re-started at certain
     hooks during locking logic
     """
     ModelMeta.session_end()
     ModelMeta.session_start()
开发者ID:loles,项目名称:solar-1,代码行数:9,代码来源:locking.py

示例4: pytest_runtest_teardown

# 需要导入模块: from solar.dblayer.model import ModelMeta [as 别名]
# 或者: from solar.dblayer.model.ModelMeta import session_end [as 别名]
def pytest_runtest_teardown(item, nextitem):
    ModelMeta.session_end(result=True)
    return nextitem
开发者ID:pigmej,项目名称:solar,代码行数:5,代码来源:conftest.py

示例5: pytest_runtest_call

# 需要导入模块: from solar.dblayer.model import ModelMeta [as 别名]
# 或者: from solar.dblayer.model.ModelMeta import session_end [as 别名]
def pytest_runtest_call(item):
    ModelMeta.session_end()
    ModelMeta.session_start()
开发者ID:loles,项目名称:solar,代码行数:5,代码来源:conftest.py

示例6: session_end

# 需要导入模块: from solar.dblayer.model import ModelMeta [as 别名]
# 或者: from solar.dblayer.model.ModelMeta import session_end [as 别名]
 def session_end(ctxt):
     log.debug('Session end ID %s', id(gevent.getcurrent()))
     ModelMeta.session_end()
开发者ID:pigmej,项目名称:solar,代码行数:5,代码来源:conftest.py

示例7: env

# 需要导入模块: from solar.dblayer.model import ModelMeta [as 别名]
# 或者: from solar.dblayer.model.ModelMeta import session_end [as 别名]

@main.command()
@click.argument('env_id')
@click.argument('uids', nargs=-1)
@click.option('-f', '--full', is_flag=True)
def env(env_id, uids, full):
    """Prepares solar environment based on fuel environment.
    It should perform all required changes for solar to work
    """
    env = Environment(env_id)
    uids = list(uids) if uids else [
        str(n.data['id']) for n in env.get_all_nodes()]
    for nobj in source.nodes(uids):
        try:
            # FIXME
            resource.load('node%s' % nobj.data['id'])
        except:
            node(nobj)
            fuel_data(nobj)
    _prefetch(env, uids)
    create_master()
    allocate(
        source.graph(env_id),
        ['null', 'master'] + uids if full else uids)


if __name__ == '__main__':
    main()
    ModelMeta.session_end()
开发者ID:Mirantis,项目名称:f2s,代码行数:31,代码来源:fsclient.py


注:本文中的solar.dblayer.model.ModelMeta.session_end方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。