Skip to content
Snippets Groups Projects
Commit fe3cdb5b authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

SW-448: merge back from...

SW-448: merge back from https://svn.astron.nl/LOFAR/branches/SW-448-robinhood-bugfix. Use normal du for now instead of robinhood-du. Easy switch back to rbh-du in october possible. Made queries and scans faster.
parents 5c4b2f88 87fcd3f8
No related branches found
Tags LOFAR-Release-3_1_6
No related merge requests found
...@@ -307,20 +307,24 @@ class CacheManager: ...@@ -307,20 +307,24 @@ class CacheManager:
for i, cache_entry in enumerate(updateable_entries): for i, cache_entry in enumerate(updateable_entries):
try: try:
path = cache_entry.get('path') # it might be that the cache_entry was already updated via another way
if path: # so only update it if still to old or needs_update
logger.info('_updateOldEntriesInCache: examining entry %s/%s. timestamp:%s age:%s needs_update:%s path: \'%s\'', now = datetime.datetime.utcnow()
i, if now - cache_entry['cache_timestamp'] > MAX_CACHE_ENTRY_AGE or cache_entry.get('needs_update', False):
len(updateable_entries), path = cache_entry.get('path')
cache_entry['cache_timestamp'], if path:
format_timedelta(now - cache_entry['cache_timestamp']), logger.info('_updateOldEntriesInCache: examining entry %s/%s. timestamp:%s age:%s needs_update:%s path: \'%s\'',
cache_entry.get('needs_update', False), i,
path) len(updateable_entries),
cache_entry['cache_timestamp'],
#du a full update from disk, which might be (really) slow. format_timedelta(now - cache_entry['cache_timestamp']),
result = du_getDiskUsageForPath(path) cache_entry.get('needs_update', False),
logger.debug('trying to update old entry in cache: %s', result) path)
self._updateCache(result)
#du a full update from disk, which might be (really) slow.
result = du_getDiskUsageForPath(path)
logger.debug('trying to update old entry in cache: %s', result)
self._updateCache(result)
except Exception as e: except Exception as e:
logger.error(str(e)) logger.error(str(e))
...@@ -328,8 +332,8 @@ class CacheManager: ...@@ -328,8 +332,8 @@ class CacheManager:
logger.info('exiting _updateCacheThread') logger.info('exiting _updateCacheThread')
return return
if datetime.datetime.utcnow() - cacheUpdateStart > datetime.timedelta(minutes=5): if datetime.datetime.utcnow() - cacheUpdateStart > datetime.timedelta(minutes=10):
# break out of cache update loop if full update takes more than 5min # break out of cache update loop if full update takes more than 1min
# next loop we'll start with the oldest cache entries again # next loop we'll start with the oldest cache entries again
logger.info('skipping remaining %s old cache entries updates, they will be updated next time', len(updateable_entries)-i) logger.info('skipping remaining %s old cache entries updates, they will be updated next time', len(updateable_entries)-i)
break break
...@@ -338,7 +342,7 @@ class CacheManager: ...@@ -338,7 +342,7 @@ class CacheManager:
self._updateCEP4CapacitiesInRADB() self._updateCEP4CapacitiesInRADB()
#sleep for a while, (or stop if requested) #sleep for a while, (or stop if requested)
for i in range(30): for i in range(10):
sleep(1) sleep(1)
if not self._cacheThreadsRunning: if not self._cacheThreadsRunning:
logger.info('exiting _updateCacheThread') logger.info('exiting _updateCacheThread')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment