jina-ai / clip-as-service

🏄 Scalable embedding, reasoning, ranking for images and sentences with CLIP
https://clip-as-service.jina.ai
Other
12.48k stars 2.07k forks source link

想了解分发任务的通信架构如何实现 #885

Closed fqzhao-win closed 1 year ago

fqzhao-win commented 1 year ago

ven-worker-sink的通信架构在clip-as-service中仍然保留嘛,在哪个部分的代码,想要具体学习一下这个部分

jemmyshin commented 1 year ago

这块具体的逻辑在jina内部,clip-as-service是对jina内部逻辑的封装,想要了解细节的话你可以具体看一下jina flow的文档:https://docs.jina.ai/concepts/flow/

fqzhao-win commented 1 year ago

谢谢您,我刚刚看了flow的文档,想问一下您flow支持添加http协议的外部程序嘛

fqzhao-win commented 1 year ago

from jina import Flow,Document

replica_hosts, replica_ports = ['localhost', '91.198.174.192'], ['12345', '12346']

Flow().add(host=replica_hosts, port=replica_ports, external=True)

alternative syntax

def main(): f = Flow().add(host=[' http://192.168.0.243:8036', ' http://192.168.0.243:8038'], external=True) print(f.is_flow_ready())

if name == 'main': main()

fqzhao-win commented 1 year ago

这里不知道为什么打印出的是Flase

fqzhao-win commented 1 year ago

ERROR GRPCClient@3104 RpcError: failed to connect to all [01/04/23 15:29:23] addresses

numb3r3 commented 1 year ago

basically, we only support grpc-based external service. Thus, the right approach is to start external service ahead:

# the flow uses default `grpc` protocol
with Flow(port='12345').add(....) as external_flow:
    # specify the external service host and port
    with Flow().add(host='0.0.0.0', port=external_flow.port, external=True) as f:
        f.post(...)
numb3r3 commented 1 year ago

The communication among gateway, and (external-)executors are all grpc-based protocol.

fqzhao-win commented 1 year ago

ok,thank you very much

fqzhao-win commented 1 year ago

不好意思再麻烦一下大家,如果我现在有一个flask服务,我在gpu上面复制了多个相同程序,分别占用不同的端口,想用ven-work-sink通信架构来解决并发问题,我可以用flow来实现嘛,把flask的内部程序做成Executor

numb3r3 commented 1 year ago

是的,完全可以用executor来解决并发扩展问题。

fqzhao-win commented 1 year ago

今天看了一天文档,但是还是没有思路,再麻烦一下你们,就是我有一个服务,这个服务的参数是一个字符串列表,想用flow实现负载均衡,jina可以实现自动对列表切分,然后把结果拼接起再返回吗,我只需要给一个切分的值,不需要做其他设计可以实现吗,头都要炸了

numb3r3 commented 1 year ago

closed by https://github.com/jina-ai/jina/issues/5575