~ubuntu-branches/ubuntu/wily/heat/wily

« back to all changes in this revision

Viewing changes to heat/engine/sync_point.py

  • Committer: Package Import Robot
  • Author(s): Corey Bryant
  • Date: 2015-08-19 08:11:50 UTC
  • mfrom: (1.1.27)
  • Revision ID: package-import@ubuntu.com-20150819081150-m969fd35xn8bdmfu
Tags: 1:5.0.0~b2-0ubuntu1
* New upstream milestone for OpenStack Liberty.
* d/control: Align (build-)depends with upstream.
* d/p/fix-requirements.patch: Dropped. No longer needed.
* d/p/fixup-assert-regex.patch: Rebased.
* d/rules: Remove .eggs directory in override_dh_auto_clean.

Show diffs side-by-side

added added

removed removed

Lines of Context:
68
68
 
69
69
def update_input_data(context, entity_id, current_traversal,
70
70
                      is_update, atomic_key, input_data):
71
 
    sync_point_object.SyncPoint.update_input_data(
 
71
    rows_updated = sync_point_object.SyncPoint.update_input_data(
72
72
        context, entity_id, current_traversal, is_update, atomic_key,
73
73
        input_data)
74
74
 
 
75
    return rows_updated
 
76
 
75
77
 
76
78
def deserialize_input_data(db_input_data):
77
79
    db_input_data = db_input_data.get('input_data')
87
89
 
88
90
def sync(cnxt, entity_id, current_traversal, is_update, propagate,
89
91
         predecessors, new_data):
90
 
    sync_point = get(cnxt, entity_id, current_traversal,
91
 
                     is_update)
92
 
    input_data = dict(deserialize_input_data(sync_point.input_data))
93
 
    input_data.update(new_data)
 
92
    rows_updated = None
 
93
    sync_point = None
 
94
    input_data = None
 
95
    while not rows_updated:
 
96
        # TODO(sirushtim): Add a conf option to add no. of retries
 
97
        sync_point = get(cnxt, entity_id, current_traversal, is_update)
 
98
        input_data = dict(deserialize_input_data(sync_point.input_data))
 
99
        input_data.update(new_data)
 
100
        rows_updated = update_input_data(
 
101
            cnxt, entity_id, current_traversal, is_update,
 
102
            sync_point.atomic_key, serialize_input_data(input_data))
 
103
 
94
104
    waiting = predecessors - set(input_data)
95
 
 
96
 
    # Note: update must be atomic
97
 
    update_input_data(cnxt, entity_id, current_traversal,
98
 
                      is_update, sync_point.atomic_key,
99
 
                      serialize_input_data(input_data))
100
 
 
101
105
    key = make_key(entity_id, current_traversal, is_update)
102
106
    if waiting:
103
107
        LOG.debug('[%s] Waiting %s: Got %s; still need %s',