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


Python ModelMeta.save_all_lazy方法代码示例

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


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

示例1: test_concurrent_sequences_with_no_handler

# 需要导入模块: from solar.dblayer.model import ModelMeta [as 别名]
# 或者: from solar.dblayer.model.ModelMeta import save_all_lazy [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.save_all_lazy()
    plan = change.send_to_orchestration()
    ModelMeta.save_all_lazy()
    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:openstack,项目名称:solar,代码行数:28,代码来源:test_complete_solar_workflow.py

示例2: test_discard_all_pending_changes_resources_created

# 需要导入模块: from solar.dblayer.model import ModelMeta [as 别名]
# 或者: from solar.dblayer.model.ModelMeta import save_all_lazy [as 别名]
def test_discard_all_pending_changes_resources_created():
    res1 = DBResource.from_dict(
        "test1",
        {
            "name": "test1",
            "base_path": "x",
            "state": RESOURCE_STATE.created.name,
            "meta_inputs": {"a": {"value": None, "schema": "str"}},
        },
    )
    res1.inputs["a"] = "9"
    res1.save_lazy()

    res2 = DBResource.from_dict(
        "test2",
        {
            "name": "test2",
            "base_path": "x",
            "state": RESOURCE_STATE.created.name,
            "meta_inputs": {"a": {"value": None, "schema": "str"}},
        },
    )
    res2.inputs["a"] = "0"
    res2.save_lazy()
    ModelMeta.save_all_lazy()

    staged_log = change.stage_changes()
    assert len(staged_log) == 2

    change.discard_all()
    staged_log = change.stage_changes()
    assert len(staged_log) == 0
    assert resource.load_all() == []
开发者ID:aglarendil,项目名称:solar,代码行数:35,代码来源:test_system_log_api.py

示例3: test_discard_connection

# 需要导入模块: from solar.dblayer.model import ModelMeta [as 别名]
# 或者: from solar.dblayer.model.ModelMeta import save_all_lazy [as 别名]
def test_discard_connection():
    res1 = DBResource.from_dict('test1',
                                {'name': 'test1',
                                 'base_path': 'x',
                                 'state': RESOURCE_STATE.created.name,
                                 'meta_inputs': {'a': {'value': None,
                                                       'schema': 'str'}}})
    res1.inputs['a'] = '9'
    res1.save_lazy()

    res2 = DBResource.from_dict('test2',
                                {'name': 'test2',
                                 'base_path': 'x',
                                 'state': RESOURCE_STATE.created.name,
                                 'meta_inputs': {'a': {'value': None,
                                                       'schema': 'str'}}})
    res2.inputs['a'] = '0'
    res2.save_lazy()
    ModelMeta.save_all_lazy()

    staged_log = change.stage_changes()
    for item in staged_log:
        operations.move_to_commited(item.log_action)

    res1 = resource.load('test1')
    res2 = resource.load('test2')
    res1.connect(res2, {'a': 'a'})
    staged_log = change.stage_changes()
    assert len(staged_log) == 1
    assert res2.args == {'a': '9'}
    change.discard_all()
    assert res2.args == {'a': '0'}
    assert len(change.stage_changes()) == 0
开发者ID:pigmej,项目名称:solar,代码行数:35,代码来源:test_system_log_api.py

示例4: create_plan_from_graph

# 需要导入模块: from solar.dblayer.model import ModelMeta [as 别名]
# 或者: from solar.dblayer.model.ModelMeta import save_all_lazy [as 别名]
def create_plan_from_graph(dg):
    dg.graph['uid'] = "{0}:{1}".format(dg.graph['name'], str(uuid.uuid4()))
    # FIXME change save_graph api to return new graph with Task objects
    # included
    save_graph(dg)
    ModelMeta.save_all_lazy()
    return get_graph(dg.graph['uid'])
开发者ID:openstack,项目名称:solar,代码行数:9,代码来源:graph.py

示例5: test_discard_all_pending_changes_resources_created

# 需要导入模块: from solar.dblayer.model import ModelMeta [as 别名]
# 或者: from solar.dblayer.model.ModelMeta import save_all_lazy [as 别名]
def test_discard_all_pending_changes_resources_created():
    res1 = DBResource.from_dict('test1',
                                {'name': 'test1',
                                 'base_path': 'x',
                                 'state': RESOURCE_STATE.created.name,
                                 'meta_inputs': {'a': {'value': None,
                                                       'schema': 'str'}}})
    res1.inputs['a'] = '9'
    res1.save_lazy()

    res2 = DBResource.from_dict('test2',
                                {'name': 'test2',
                                 'base_path': 'x',
                                 'state': RESOURCE_STATE.created.name,
                                 'meta_inputs': {'a': {'value': None,
                                                       'schema': 'str'}}})
    res2.inputs['a'] = '0'
    res2.save_lazy()
    ModelMeta.save_all_lazy()

    staged_log = change.stage_changes()
    assert len(staged_log) == 2

    change.discard_all()
    staged_log = change.stage_changes()
    assert len(staged_log) == 0
    assert resource.load_all() == []
开发者ID:pigmej,项目名称:solar,代码行数:29,代码来源:test_system_log_api.py

示例6: test_revert_create

# 需要导入模块: from solar.dblayer.model import ModelMeta [as 别名]
# 或者: from solar.dblayer.model.ModelMeta import save_all_lazy [as 别名]
def test_revert_create():
    res = DBResource.from_dict('test1',
                               {'name': 'test1',
                                'base_path': 'x',
                                'state': RESOURCE_STATE.created.name,
                                'meta_inputs': {'a': {'value': None,
                                                      'schema': 'str'}}})
    res.inputs['a'] = '9'
    res.save_lazy()
    ModelMeta.save_all_lazy()

    staged_log = change.stage_changes()
    assert len(staged_log) == 1
    logitem = staged_log[0]
    operations.move_to_commited(logitem.log_action)
    assert logitem.diff == [['add', '', [['a', '9']]]]

    commited = CommitedResource.get('test1')
    assert commited.inputs == {'a': '9'}

    change.revert(logitem.uid)

    staged_log = change.stage_changes()
    assert len(staged_log) == 1
    for item in staged_log:
        operations.move_to_commited(item.log_action)

    assert resource.load_all() == []
开发者ID:pigmej,项目名称:solar,代码行数:30,代码来源:test_system_log_api.py

示例7: test_update_action_after_commit

# 需要导入模块: from solar.dblayer.model import ModelMeta [as 别名]
# 或者: from solar.dblayer.model.ModelMeta import save_all_lazy [as 别名]
def test_update_action_after_commit():
    res = resource.load(create_resource('1').name)
    res.set_operational()
    res.update({'a': 10})
    ModelMeta.save_all_lazy()
    staged_log = change.staged_log()
    assert staged_log[0].action == 'update'
开发者ID:openstack,项目名称:solar,代码行数:9,代码来源:test_system_log_api.py

示例8: test_revert_create

# 需要导入模块: from solar.dblayer.model import ModelMeta [as 别名]
# 或者: from solar.dblayer.model.ModelMeta import save_all_lazy [as 别名]
def test_revert_create():
    res = DBResource.from_dict(
        "test1",
        {
            "name": "test1",
            "base_path": "x",
            "state": RESOURCE_STATE.created.name,
            "meta_inputs": {"a": {"value": None, "schema": "str"}},
        },
    )
    res.inputs["a"] = "9"
    res.save_lazy()
    ModelMeta.save_all_lazy()

    staged_log = change.stage_changes()
    assert len(staged_log) == 1
    logitem = staged_log[0]
    operations.move_to_commited(logitem.log_action)
    assert logitem.diff == [["add", "", [["a", "9"]]]]

    commited = CommitedResource.get("test1")
    assert commited.inputs == {"a": "9"}

    change.revert(logitem.uid)

    staged_log = change.stage_changes()
    assert len(staged_log) == 1
    for item in staged_log:
        operations.move_to_commited(item.log_action)
    assert resource.load_all() == []
开发者ID:aglarendil,项目名称:solar,代码行数:32,代码来源:test_system_log_api.py

示例9: test_discard_removed

# 需要导入模块: from solar.dblayer.model import ModelMeta [as 别名]
# 或者: from solar.dblayer.model.ModelMeta import save_all_lazy [as 别名]
def test_discard_removed():
    res1 = DBResource.from_dict(
        "test1",
        {
            "name": "test1",
            "base_path": "x",
            "state": RESOURCE_STATE.created.name,
            "meta_inputs": {"a": {"value": None, "schema": "str"}},
        },
    )
    res1.inputs["a"] = "9"
    res1.save_lazy()
    ModelMeta.save_all_lazy()
    staged_log = change.stage_changes()
    for item in staged_log:
        operations.move_to_commited(item.log_action)
    res1 = resource.load("test1")
    res1.remove()
    assert len(change.stage_changes()) == 1
    assert res1.to_be_removed()

    change.discard_all()

    assert len(change.stage_changes()) == 0
    assert not resource.load("test1").to_be_removed()
开发者ID:aglarendil,项目名称:solar,代码行数:27,代码来源:test_system_log_api.py

示例10: set_states

# 需要导入模块: from solar.dblayer.model import ModelMeta [as 别名]
# 或者: from solar.dblayer.model.ModelMeta import save_all_lazy [as 别名]
def set_states(uid, tasks):
    plan = get_graph(uid)
    for t in tasks:
        if t not in plan.node:
            raise Exception("No task %s in plan %s", t, uid)
        plan.node[t]['task'].status = states.NOOP.name
        plan.node[t]['task'].save_lazy()
    ModelMeta.save_all_lazy()
开发者ID:aglarendil,项目名称:solar,代码行数:10,代码来源:graph.py

示例11: test_discard_update

# 需要导入模块: from solar.dblayer.model import ModelMeta [as 别名]
# 或者: from solar.dblayer.model.ModelMeta import save_all_lazy [as 别名]
def test_discard_update():
    res1 = create_resource('test1')
    res1.db_obj.inputs['a'] = '9'
    operations.commit_log_item(change.create_run(res1))
    res1.update({'a': '11'})
    ModelMeta.save_all_lazy()
    assert len(change.staged_log()) == 1
    assert res1.args == {'a': '11'}

    change.discard_single(change.staged_log()[0])
    assert res1.args == {'a': '9'}
开发者ID:openstack,项目名称:solar,代码行数:13,代码来源:test_system_log_api.py

示例12: test_childs_added_on_stage

# 需要导入模块: from solar.dblayer.model import ModelMeta [as 别名]
# 或者: from solar.dblayer.model.ModelMeta import save_all_lazy [as 别名]
def test_childs_added_on_stage():
    res_0, res_1 = [create_resource(str(n)) for n in range(2)]
    res_0.connect(res_1, {'a': 'a'})
    ModelMeta.save_all_lazy()
    created_log_items = stage_resources(res_0.name, 'run')
    assert len(created_log_items) == 1
    assert created_log_items[0].resource == res_0.name
    staged_log = change.staged_log()
    assert len(staged_log) == 2
    child_log_item = next(li for li in staged_log
                          if li.resource == res_1.name)
    assert child_log_item.action == 'run'
开发者ID:pigmej,项目名称:solar-1,代码行数:14,代码来源:test_system_log_api.py

示例13: test_discard_update

# 需要导入模块: from solar.dblayer.model import ModelMeta [as 别名]
# 或者: from solar.dblayer.model.ModelMeta import save_all_lazy [as 别名]
def test_discard_update():
    res1 = create_resource('test1')
    res1.inputs['a'] = '9'
    res1.save_lazy()
    operations.commit_log_item(change.create_run(res1.name))
    res1 = resource.load('test1')
    res1.update({'a': '11'})
    ModelMeta.save_all_lazy()
    assert len(change.staged_log()) == 1
    assert res1.args == {'a': '11'}

    change.discard_all()
    assert res1.args == {'a': '9'}
开发者ID:pigmej,项目名称:solar-1,代码行数:15,代码来源:test_system_log_api.py

示例14: tagged_resources

# 需要导入模块: from solar.dblayer.model import ModelMeta [as 别名]
# 或者: from solar.dblayer.model.ModelMeta import save_all_lazy [as 别名]
def tagged_resources():
    tags = ['n1', 'n2', 'n3']
    t1 = Resource.from_dict('t1',
                            {'name': 't1', 'tags': tags, 'base_path': 'x'})
    t1.save_lazy()
    t2 = Resource.from_dict('t2',
                            {'name': 't2', 'tags': tags, 'base_path': 'x'})
    t2.save_lazy()
    t3 = Resource.from_dict('t3',
                            {'name': 't3', 'tags': tags, 'base_path': 'x'})
    t3.save_lazy()
    ModelMeta.save_all_lazy()
    return [t1, t2, t3]
开发者ID:aglarendil,项目名称:solar,代码行数:15,代码来源:test_operations_with_tags.py

示例15: test_discard_removed

# 需要导入模块: from solar.dblayer.model import ModelMeta [as 别名]
# 或者: from solar.dblayer.model.ModelMeta import save_all_lazy [as 别名]
def test_discard_removed():
    res1 = create_resource('test1')
    res1.db_obj.inputs['a'] = '9'
    res1.db_obj.save_lazy()

    res1 = resource.load('test1')
    res1.remove()
    ModelMeta.save_all_lazy()
    assert len(change.staged_log()) == 1
    assert res1.to_be_removed()

    change.discard_all()

    assert len(change.staged_log()) == 0
    assert not resource.load('test1').to_be_removed()
开发者ID:openstack,项目名称:solar,代码行数:17,代码来源:test_system_log_api.py


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