def prefetchRemoteData(requestContext, targets): """Prefetch a bunch of path expressions and stores them in the context. The idea is that this will allow more batching that doing a query each time evaluateTarget() needs to fetch a path. All the prefetched data is stored in the requestContext, to be accessed later by datalib. """ log.rendering("Prefetching remote data") pathExpressions = extractPathExpressions(targets) results = STORE.fetch_remote(pathExpressions, requestContext) # TODO: instead of doing that it would be wait better to use # the shared cache to cache pathExpr instead of full queries. requestContext['prefetched'] = PrefetchedData(results)
def prefetchRemoteData(requestContext, targets): """Prefetch a bunch of path expressions and stores them in the context. The idea is that this will allow more batching that doing a query each time evaluateTarget() needs to fetch a path. All the prefetched data is stored in the requestContext, to be accessed later by datalib. """ log.rendering("Prefetching remote data") pathExpressions = extractPathExpressions(targets) (startTime, endTime, now) = timebounds(requestContext) results = STORE.fetch_remote(pathExpressions, startTime, endTime, now, requestContext) requestContext['prefetched'][(startTime, endTime, now)] = PrefetchedData(results)
def prefetchRemoteData(requestContext, targets): """Prefetch a bunch of path expressions and stores them in the context. The idea is that this will allow more batching that doing a query each time evaluateTarget() needs to fetch a path. All the prefetched data is stored in the requestContext, to be accessed later by datalib. """ pathExpressions = extractPathExpressions(targets) log.rendering("Prefetching remote data for [%s]" % (', '.join(pathExpressions))) (startTime, endTime, now) = timebounds(requestContext) results = STORE.fetch_remote(pathExpressions, startTime, endTime, now, requestContext) requestContext['prefetched'][(startTime, endTime, now)] = PrefetchedData(results)
def prefetchRemoteData(requestContext, targets): """Prefetch a bunch of path expressions and stores them in the context. The idea is that this will allow more batching that doing a query each time evaluateTarget() needs to fetch a path. All the prefetched data is stored in the requestContext, to be accessed later by datalib. """ # only prefetch if there is at least one active remote finder # this is to avoid the overhead of tagdb lookups in extractPathExpressions if len([finder for finder in STORE.finders if not getattr(finder, 'local', True) and not getattr(finder, 'disabled', False)]) < 1: return pathExpressions = extractPathExpressions(targets) log.rendering("Prefetching remote data for [%s]" % (', '.join(pathExpressions))) (startTime, endTime, now) = timebounds(requestContext) results = STORE.fetch_remote(pathExpressions, startTime, endTime, now, requestContext) requestContext['prefetched'][(startTime, endTime, now)] = PrefetchedData(results)