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

Make Executor a base class so new attributes don't break out-of-tree executors

Abierto
#956 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
45/100
Tipo de issue
Refactorización
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
python
Área
backend

Línea de trabajo

Start in climate_ref_core/executor.py, where Executor is a runtime_checkable Protocol, then check the isinstance gate in ExecutorConfig.build at climate_ref/config.py:397. Convert Executor to an ABC with abstract run and join, and give collects_results_on_join, runs_on_solve_host and log_submission_summary defaults. Make LocalExecutor, SynchronousExecutor, HPCExecutor and CeleryExecutor subclass it, and replace the solver's getattr probes with attribute access. Done when the in-tree executors pass the isinstance check and the test suite is green.

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

Descripción

Executor (climate_ref_core/executor.py) is a @runtime_checkable Protocol, and ExecutorConfig.build rejects any executor that fails isinstance(executor, Executor) (climate_ref/config.py:397). A runtime protocol check requires every member, including data attributes, so adding a member to the protocol breaks every out-of-tree executor. collects_results_on_join did this in e4ada47bc without a changelog entry.

Optional behaviour is also probed with getattr in the solver (collects_results_on_join, log_submission_summary, and runs_on_solve_host from #955), so these attributes are invisible to type checkers and docs. The in-tree executors are inconsistent: CeleryExecutor subclasses Executor, while LocalExecutor, SynchronousExecutor and HPCExecutor do not.

Suggested fix:

  • Turn Executor into an abstract base class with run and join as abstract methods.
  • Give the optional flags and hooks defaults on the base class (collects_results_on_join = False, runs_on_solve_host = False, a no-op log_submission_summary).
  • Make all four in-tree executors subclass it and replace the solver's getattr probes with attribute access.
  • Keep the isinstance check in ExecutorConfig.build.

This is a one-off breaking change as out-of-tree executors must subclass Executor, although I doubt that this will impact anyone. After that, new flags with defaults break nobody.

Lenguaje dominante
Python
Estrellas
27
Forks
14
Merge medio
1 d 2 h
PR fusionados (30 d)
75

Preparar el entorno

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 Climate-REF/climate-ref

Todos los issues de Climate-REF/climate-ref

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.