src/server/worker/client.go
func Conns(ctx context.Context, pipelineRcName string, etcdClient *etcd.Client, etcdPrefix string, workerGrpcPort uint16) ([]*grpc.ClientConn, error) {
	resp, err := etcdClient.Get(ctx, path.Join(etcdPrefix, WorkerEtcdPrefix, pipelineRcName), etcd.WithPrefix())
	if err != nil {
		return nil, err
	}
	var result []*grpc.ClientConn
	for _, kv := range resp.Kvs {
		conn, err := grpc.Dial(fmt.Sprintf("%s:%d", path.Base(string(kv.Key)), workerGrpcPort),
			append(client.DefaultDialOptions(), grpc.WithInsecure())...)
		if err != nil {
			return nil, err
		}
		result = append(result, conn)
	}
	return result, nil
}
func Conns(ctx context.Context, pipelineRcName string, etcdClient *etcd.Client, etcdPrefix string, workerGrpcPort uint16) ([]*grpc.ClientConn, error) {
	resp, err := etcdClient.Get(ctx, path.Join(etcdPrefix, WorkerEtcdPrefix, pipelineRcName), etcd.WithPrefix())
	if err != nil {
		return nil, err
	}
	var result []*grpc.ClientConn
	for _, kv := range resp.Kvs {
		conn, err := grpc.Dial(fmt.Sprintf("%s:%d", path.Base(string(kv.Key)), workerGrpcPort),
			append(client.DefaultDialOptions(), grpc.WithInsecure())...)
		if err != nil {
			return nil, err
		}
		result = append(result, conn)
	}
	return result, nil
}
func Conns ( ctx context . Context , pipelineRcName string , etcdClient * etcd . Client , etcdPrefix string , workerGrpcPort uint16 ) ( [ ] * grpc . ClientConn , error ) { resp , err := etcdClient . Get ( ctx , path . Join ( etcdPrefix , WorkerEtcdPrefix , pipelineRcName ) , etcd . WithPrefix ( ) ) if err != nil { return nil , err } var result [ ] * grpc . ClientConn for _ , kv := range resp . Kvs { conn , err := grpc . Dial ( fmt . Sprintf ( " " , path . Base ( string ( kv . Key ) ) , workerGrpcPort ) , append ( client . DefaultDialOptions ( ) , grpc . WithInsecure ( ) ) ... ) if err != nil { return nil , err } result = append ( result , conn ) } return result , nil }
// Conns returns a slice of connections to worker servers.
// pipelineRcName is the name of the pipeline's RC and can be gotten with
// ppsutil.PipelineRcName. You can also pass "" for pipelineRcName to get all
// clients for all workers.
Conns returns a slice of connections to worker servers . pipelineRcName is the name of the pipeline s RC and can be gotten with ppsutil . PipelineRcName . You can also pass for pipelineRcName to get all clients for all workers .