Closed maximilianwerk closed 3 years ago
So basically what we're doing is "hiding" away the driver, right? I like it! It always seemed a bit too much upfront work to customize this.
Random thoughts on this:
traversal_path
. Need to provide this. Something like RequestArguments
? exec_fn
, right? def __call__(self, *args, **kwargs):
"""call all executors for the current requests with the additional call arguments."""
call_flow = self.call_flow[self.request.type]
for executor in call_flow:
arguments = kwargs.deepcopy()
arguments.update(executor.additional_call_arguments)
executor.apply(*args, **arguments)
where drivers actually behave differently. E.g. CacheDriver expects a return and then calls another method on the executor depending on the value received
def _apply_all(self, docs: 'DocumentSet', *args, **kwargs) -> None:
if self._method_name == 'update':
values = [BaseCacheDriver.hash_doc(d, self.exec.fields) for d in docs]
self.exec_fn([d.id for d in docs], values)
else:
for d in docs:
value = BaseCacheDriver.hash_doc(d, self.exec.fields)
result = self.exec[value]
if result:
self.on_hit(d, result)
else:
self.on_miss(d, value)
Just saying so that we are aware of where the complexity will move.
Hi @maximilianwerk 👋
Is this issue still relevant given all discussions with 2.0? Just felt maybe decision about it had already been made.
Describe the feature
The Driver is a Jina component that should be hidden away from an user. I suggest, it evolves into a combination of a request dispatcher and compounding multiple Executors. I envision the following yaml syntax on pod level:
The following would be rough psydo code of how the
GenericExecutorDriver
handles the parsed YAML:Beware of the following features:
traversal_paths
or the sameQueryLangExecutor
with different call arguments (Like ExludeQL andfields
).executor.apply(...)
should be changed into the proper function per request type as defined via the@requests
decorator.ExecutorWrapper
implicitly around all executors in the lower part.This solution should be extended, such that
and
results in the same in memory objects and the second is just a syntax sugar for the first.