Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta
#956 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
45/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Python
Stelle
27
Fork
14
Merge medio
1g 4h
PR unite (30g)
68

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Climate-REF/climate-ref

Tutte le issue di Climate-REF/climate-ref

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.