xdist master cant see workers' workeroutput when using --forked
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- python
- Área
- testing-qa
Línea de trabajo
Empieza rastreando los hooks pytest_sessionfinish y pytest_testnodedown descritos en el issue, junto con el manejo de --forked por parte de pytest-forked y el archivo newhooks.py mencionado. Reproduce el problema con las versiones indicadas de Python, pytest, pytest-xdist y pytest-forked. Se considera terminado cuando las estadísticas de los workers están disponibles para el master durante pytest_testnodedown al habilitar --forked.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Hi fellas.
I am building a tests profiler for collecting various statistics before/during test cases execution.
Since we use pytest-xdist, I decided its finally time to look into how new xdist hooks from newhooks.py work and try to get as much value out of them as possible, since doing shenanigans with locks and writing output to tmp files is pretty ugly.
I have finished my profiler MVP, and it was working nicely, until I tried to run it in our jenkins which uses --forked option.
setup
python-3.8.10
pytest-7.4.3
pytest-xdist-3.3.1
pytest-forked-1.6.0
ISSUE
Turned out no stats are being displayed when I use this option.
Inside pytest_testnodedown hook, where master node is collecting and aggregating collected statistics from all worker nodes, the node.workeroutput attribute is simply empty.
Is there some workaround for this, on how to properly send data from workers to master when using --forked? Am I just missing something?
Here are 2 most important hooks used for collecting and aggregating all the statistics.
@pytest.hookimpl(hookwrapper=True, tryfirst=True)
def pytest_sessionfinish(self):
worker_id = get_xdist_worker_id(self)
if worker_id != "master":
# NOTE: Execnet can't serialize custom classes. Serialization has to be
# implemented for everything we want to send in-between master and workers
self.config.workeroutput[
f"{worker_id}-stats"
] = self._profiling_stats.serialize()
yield
@pytest.hookimpl(trylast=True)
def pytest_testnodedown(self, node):
worker_id = node.workerinput["workerid"]
node_stats = node.workeroutput[f"{worker_id}-stats"]
node_stats = ProfilerNamespaceUnit.deserialize(node_stats)
self._profiling_stats.merge_trees(node_stats)
- Lenguaje dominante
- Python
- Estrellas
- 83
- Forks
- 29
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de pytest-dev/pytest-forked
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
pytest-dev/pytest-forked#106 ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 62/100
pytest-dev/pytest-forked#84 ·
-
Fork per subpath Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
pytest-dev/pytest-forked#94 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
pytest-dev/pytest-forked#88 · 12 comentarios ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 48/100
pytest-dev/pytest-forked#85 · 3 comentarios ·
Todos los issues de pytest-dev/pytest-forked
Issues similares
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 75/100
-
hcocena Abiertopolicies-accepted pre-review precheck-passed
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
Bioconductor/BiocContributions#214 · 5 comentarios ·
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 92/100
TencentCloud/Octop#1169 · 1 comentario ·
-
[开源推荐] 在老板拷问你之前,先让 AI 灵魂拷问你 Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
521xueweihan/HelloGitHub#3778 ·
-
The version checker's trailing attribute region has no control for a less-than inside a quoted value Abiertoarea: dashboard area: tests bug perceived difficulty: 2 python
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Nitjsefnie-Harness-Commons/daedalus#1105 · 1 comentario ·