Commit 6ed95bf7 authored by sumpfralle's avatar sumpfralle

removed useless local cache for the process pusher

adjusted the ContourFollow strategy to use caching properly


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@747 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent 198a3ab2
This diff is collapsed.
...@@ -254,7 +254,6 @@ def run_in_parallel_remote(func, args_list, unordered=False, ...@@ -254,7 +254,6 @@ def run_in_parallel_remote(func, args_list, unordered=False,
results_queue = __manager.results() results_queue = __manager.results()
remote_cache = __manager.cache() remote_cache = __manager.cache()
stats = __manager.statistics() stats = __manager.statistics()
local_cache = {}
for args in args_list: for args in args_list:
start_time = time.time() start_time = time.time()
result_args = [] result_args = []
...@@ -262,13 +261,9 @@ def run_in_parallel_remote(func, args_list, unordered=False, ...@@ -262,13 +261,9 @@ def run_in_parallel_remote(func, args_list, unordered=False,
# add the argument to the cache if possible # add the argument to the cache if possible
if hasattr(arg, "uuid"): if hasattr(arg, "uuid"):
data_uuid = ProcessDataCacheItemID(arg.uuid) data_uuid = ProcessDataCacheItemID(arg.uuid)
if not data_uuid in local_cache.keys(): if not remote_cache.contains(data_uuid):
local_cache[data_uuid] = arg log.debug("Adding cache item for job %s: %s - %s" % (job_id, arg.uuid, arg.__class__))
log.debug("Adding item to manager's local cache " \ remote_cache.add(data_uuid, arg)
+ "(job: %s): %s - %s" \
% (job_id, arg.uuid, arg.__class__))
if not remote_cache.contains(data_uuid):
remote_cache.add(data_uuid, arg)
result_args.append(data_uuid) result_args.append(data_uuid)
else: else:
result_args.append(arg) result_args.append(arg)
...@@ -404,6 +399,7 @@ class ProcessStatistics(object): ...@@ -404,6 +399,7 @@ class ProcessStatistics(object):
self.queues[name].transfer_time += amount self.queues[name].transfer_time += amount
# TODO: implement an expiry time for cache items
class ProcessDataCache(object): class ProcessDataCache(object):
def __init__(self): def __init__(self):
...@@ -417,7 +413,6 @@ class ProcessDataCache(object): ...@@ -417,7 +413,6 @@ class ProcessDataCache(object):
def add(self, name, value): def add(self, name, value):
if isinstance(name, ProcessDataCacheItemID): if isinstance(name, ProcessDataCacheItemID):
name = name.value name = name.value
log.debug("Added cache item: %s - %s" % (name, type(value)))
self.cache[name] = value self.cache[name] = value
def get(self, name): def get(self, name):
...@@ -428,7 +423,6 @@ class ProcessDataCache(object): ...@@ -428,7 +423,6 @@ class ProcessDataCache(object):
def remove(self, name): def remove(self, name):
if isinstance(name, ProcessDataCacheItemID): if isinstance(name, ProcessDataCacheItemID):
name = name.value name = name.value
log.debug("Removed cache item: %s - %s" % (name, type(value)))
if name in self.cache: if name in self.cache:
del self.cache[name] del self.cache[name]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment