Edge case for processing 1 file when >1 workers are provided

Abierto
#773 0 comentarios 0 reacciones 1 asignado Ver en GitHub

@pweigel ya está trabajando en esto.

Desde el 25/11/2024.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

bug

Describe the bug
There seems to be a weird edge case when processing single file "datasets" using more than one worker. I guess this is because https://github.com/graphnet-team/graphnet/blob/65ec11c8ee5f5b8448343a2254df9d6a9bc6187c/src/graphnet/data/dataconverter.py#L277-L293 is setting n_workers = 1 when there is one file and does not use multiprocessing, but https://github.com/graphnet-team/graphnet/blob/65ec11c8ee5f5b8448343a2254df9d6a9bc6187c/src/graphnet/data/dataconverter.py#L259-L263 uses self._num_workers and tries to access the global variables that are used for multiprocessing.

To Reproduce
Steps to reproduce the behavior:

  1. Process i3 files using >1 workers and only one file in the input folder

Expected behavior
It should allocate just one worker and be processed normally.

Full traceback

File "<path>/graphnet/src/graphnet/data/dataconverter.py", line 260, in _request_event_nos

    with global_index.get_lock():  # type: ignore[name-defined]
         ^^^^^^^^^^^^
NameError: name 'global_index' is not defined. Did you mean: 'init_global_index'?
Lenguaje dominante
Python
Estrellas
117
Forks
115
Merge medio
2 d 21 h
PR fusionados (30 d)
1

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 graphnet-team/graphnet

Todos los issues de graphnet-team/graphnet

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.