From 56b4c5cefb65f1cb76445a621087a3f4ab2fc3e9 Mon Sep 17 00:00:00 2001 From: Bin Yang Date: Tue, 2 Apr 2019 10:32:20 +0000 Subject: Integrate heatbridge logic to infra_workload API Offload the heatbridge to thread Change-Id: I66c32e7ee30a40542e6ba75087d7d88caaf0c640 Issue-ID: MULTICLOUD-561 Signed-off-by: Bin Yang --- share/common/msapi/helper.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'share/common') diff --git a/share/common/msapi/helper.py b/share/common/msapi/helper.py index 979c7feb..48626cc9 100644 --- a/share/common/msapi/helper.py +++ b/share/common/msapi/helper.py @@ -180,6 +180,7 @@ class MultiCloudThreadHelper(object): # "payload": opaque object to pass to the worker for processing # "repeat": interval in micro-seconds for repeating this worker, 0 for one time worker # "timestamp": time stamp of last invocation of this worker, 0 for initial state + # "status": opaque object to represent the progress of the backlog processing # } # format of backlog: # {"": , ...} @@ -266,11 +267,12 @@ class MultiCloudThreadHelper(object): item["status"] = worker(payload) or 0 except Exception as e: item["status"] = e.message - item["timestamp"] = now if item.get("repeat", 0) == 0: self.owner.remove(backlog_id) - self.owner.expired_backlog[backlog_id] = item - pass + # keep only the id and status + self.owner.expired_backlog[backlog_id] = {"status": item["status"]} + else: + item["timestamp"] = now pass # end of loop logger.debug("stop processing backlogs") -- cgit 1.2.3-korg