rename should_handle_call_id into (inverted) already_handled
authorThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Thu, 7 Apr 2011 13:57:59 +0000 (15:57 +0200)
committerThierry Parmentelat <thierry.parmentelat@sophia.inria.fr>
Thu, 7 Apr 2011 13:57:59 +0000 (15:57 +0200)
sfa/managers/aggregate_manager_eucalyptus.py
sfa/managers/aggregate_manager_max.py
sfa/managers/aggregate_manager_pl.py
sfa/managers/aggregate_manager_vini.py
sfa/managers/slice_manager_pl.py
sfa/util/callids.py

index a70d0b3..2a36ce9 100644 (file)
@@ -395,7 +395,7 @@ class ZoneResultParser(object):
         return clusterList
 
 def get_rspec(api, creds, options, call_id): 
-    if not Callids().should_handle_call_id(call_id): return ""
+    if Callids().already_handled(call_id): return ""
     global cloud
     # get slice's hrn from options
     xrn = options.get('geni_slice_urn', '')
index 0b37bb3..9e233ff 100644 (file)
@@ -255,7 +255,7 @@ def create_slice_max_aggregate(api, hrn, nodes):
 
 
 def get_rspec(api, creds, options, call_id):
-    if not Callids().should_handle_call_id(call_id): return ""
+    if Callids().already_handled(call_id): return ""
     # get slice's hrn from options
     xrn = options.get('geni_slice_urn', '')
     hrn, type = urn_to_hrn(xrn)
index 0c52d9f..790a1e7 100644 (file)
@@ -293,8 +293,9 @@ def get_slices(api, creds):
     
 # xxx Thierry : caching at the aggregate level sounds wrong...
 caching=True
+#caching=False
 def get_rspec(api, creds, options,call_id):
-    if not Callids().should_handle_call_id(call_id): return ""
+    if Callids().already_handled(call_id): return ""
     # get slice's hrn from options
     xrn = options.get('geni_slice_urn', '')
     (hrn, type) = urn_to_hrn(xrn)
index e16d201..72ff27f 100644 (file)
@@ -90,7 +90,7 @@ def create_slice(api, xrn, creds, xml, users):
     return True
 
 def get_rspec(api, creds, options,call_id):
-    if not Callids().should_handle_call_id(call_id): return ""
+    if Callids().already_handled(call_id): return ""
     # get slice's hrn from options
     xrn = options.get('geni_slice_urn', '')
     hrn, type = urn_to_hrn(xrn)
index bc777a6..80588f7 100644 (file)
@@ -325,9 +325,10 @@ def get_slices(api, creds):
 
 # Thierry : caching at the slicemgr level makes sense to some extent
 caching=True
+#caching=False
 def get_rspec(api, creds, options, call_id):
 
-    if not Callids().should_handle_call_id(call_id): 
+    if Callids().already_handled(call_id): 
         api.logger.info("%d received get_rspec with known call_id %s"%(api.interface,call_id))
         return ""
 
index 23e0c53..904c42b 100644 (file)
@@ -28,9 +28,9 @@ class _call_ids_impl (dict):
 
     # the only primitive
     # return True if the callid is unknown, False otherwise
-    def should_handle_call_id (self,call_id):
+    def already_handled (self,call_id):
         # if not provided in the call...
-        if not call_id: return True
+        if not call_id: return False
         has_lock=False
         for attempt in range(_call_ids_impl.retries):
             if debug: sfa_logger().debug("Waiting for lock (%d)"%attempt)
@@ -42,17 +42,17 @@ class _call_ids_impl (dict):
         # in the unlikely event where we can't get the lock
         if not has_lock:
             sfa_logger().warning("_call_ids_impl.should_handle_call_id: could not acquire lock")
-            return True
+            return False
         # we're good to go
         if self.has_key(call_id):
             self._purge()
             self._lock.release()
-            return False
+            return True
         self[call_id]=time.time()
         self._purge()
         self._lock.release()
         if debug: sfa_logger().debug("released lock")
-        return True
+        return False
         
     def _purge(self):
         now=time.time()