Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Multiple concurrent gRPC subscriptions

Abierto
#23 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
25/100
Tipo de issue
Documentación
Claridad
Necesita aclaración
Estado de actividad
Estancado
Stack tecnológico
grpc, python
Área
api, networking

Línea de trabajo

Comienza con el ejemplo get_if_rate.py y el punto de entrada GRPCClient.subscribe(query) descrito en el issue. Investiga cómo se podrían gestionar múltiples streams de dispositivos, VRF y peers sin un hilo por suscripción, incluida la limitación de asyncio indicada. Se considerará terminado cuando el enfoque escalable compatible esté aclarado en la documentación o en un ejemplo nuevo.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

I am struggling to work out how to subscribe to multiple streams of information. In my case that I am testing with at the moment, I want to subscribe to multiple bits of BGP information across multiple devices and react to changes.

Devices:
path_elements = ["DatasetInfo", "Devices"]

Then for each device it's BGP VRFS:
path_elements = ["Devices", <DeviceID>, "versioned-data", "routing", "bgp", "status", "vrf"]

Then for each device VRF, it's BGP Peers:
path_elements = ["Devices", <DeviceID>, "versioned-data", "routing", "bgp", "status", "vrf", <VRF>, "bgpPeerInfoStatusEntry"]

My script then reacts to event changes in the BGP peer states, and also adds or removed devices VRFs and peers as the updates come in. It almost works beautifully, but...

Because the grpc_client.subscribe(query) never returns, I initially ran it in a thread. This works for a few devices, VRFs and Peers, but is not very scalable. Once I got to 129 threads, I could not run any more. I tried using asyncio, but it appears while grpcio is supposed to support asyncio the cloudvision module does not. The examples as far as I can see only have very simplistic subscribe models. For example, the get_if_rate.py only gets a single metric from a single interface.

    with GRPCClient(apiserverAddr, token=token, certs=cert, key=key,
                    ca=ca) as client:
        for batch in client.subscribe(query):
            for notif in batch["notifications"]:
                pretty_print(notif["updates"])

I can't see a good way to deal with subscriptions in a scalable way using the cloudvision module. can someone please clarify how this should be done. It would be good if this can also be reflected in the Docs or examples. If it is already in there, and I am blind or stupid, can someone please point me in the right direction.

Lenguaje dominante
Python
Estrellas
37
Forks
26
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

  • Incluye un Dockerfile o un archivo de Docker Compose
  • Sin plantilla de pull request
  • Sin guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de aristanetworks/cloudvision-python

Todos los issues de aristanetworks/cloudvision-python

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.