`num_of_loaded_sims` counts the blank lines of an outputs log
Mantenedores costumam responder em até 3 dias
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 76/100
Direção de pesquisa
Comece lendo o setter output_file e os leitores _read_log_file e _checkpoint_rows mencionados na issue. Compare como o setter conta as linhas dos logs .txt e .csv com as linhas retornadas por esses leitores, incluindo linhas em branco. O trabalho estará concluído quando num_of_loaded_sims corresponder às linhas carregadas nos dois formatos e a reprodução prosseguir até chamar simulate.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Describe the bug
set_num_of_loaded_sims counts every line of a .txt outputs log, blank ones included, and every line after the header of a .csv one. _read_log_file and _checkpoint_rows skip blank lines, so a log with one has a num_of_loaded_sims larger than len(outputs_log).
simulate_convergence uses that count as its budget, and info() and the message printed when a log is loaded report it.
To Reproduce
import pathlib
import tempfile
from rocketpy import MonteCarlo
def simulate(**kwargs):
raise RuntimeError("simulate called")
folder = pathlib.Path(tempfile.mkdtemp())
(folder / "study.outputs.txt").write_text(
'{"index": 0, "apogee": 1.0}\n\n{"index": 1, "apogee": 2.0}\n\n'
)
mc = MonteCarlo.__new__(MonteCarlo)
mc.filename = folder / "study"
mc.simulate = simulate
history = mc.simulate_convergence(
target_attribute="apogee", tolerance=1e-9, max_simulations=4, batch_size=2
)
# A total of 4 simulation results were loaded from: .../study.outputs.txt
print(len(mc.outputs_log), mc.num_of_loaded_sims, history) # 2 4 []
No RuntimeError, so simulate is never called. __new__ and the replaced simulate only keep flights out of the example; the count comes from the output_file setter. A .csv log with a blank line between two rows counts 3.
Run on develop at d3cf83a7.
Expected behavior
num_of_loaded_sims matches the rows the readers return. The example above then goes on to simulate, where the stub raises instead of running two more flights.
Additional context
Raised in the review of #1198: https://github.com/RocketPy-Team/RocketPy/pull/1198#issuecomment-7365111426. On that branch the new "The logs already hold N simulations" warning reads this count, so the example above also warns that the logs hold 4.
- Linguagem predominante
- Python
- Estrelas
- 1.1k
- Forks
- 280
- Merge médio
- 3d 2h
- PRs com merge (30d)
- 24
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de RocketPy-Team/RocketPy
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
RocketPy-Team/RocketPy#1241 ·
Mantenedores costumam responder em até 3 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 84/100
RocketPy-Team/RocketPy#1202 ·
Mantenedores costumam responder em até 3 dias
-
Monte Carlo test fixtures write their logs into the working directoryTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
RocketPy-Team/RocketPy#1189 ·
Mantenedores costumam responder em até 3 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
RocketPy-Team/RocketPy#1171 · 1 comentário ·
Mantenedores costumam responder em até 3 dias
-
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 56/100
RocketPy-Team/RocketPy#1251 ·
Mantenedores costumam responder em até 3 dias
Todas as issues de RocketPy-Team/RocketPy
Issues semelhantes
-
docs(contributing): the two things that silently block a PRTalvez já em andamento Um pull request vinculado a esta issue está aberto ou já foi mesclado. Abertaavailable documentation good first issue
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 95/100
Nixitov/Riptide-Native#944 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
JTHCode/secretguard#24 ·
Mantenedores costumam responder em até 1 dia
-
area: middleware documentation good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
-
enhancement good first issue
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
Mantenedores costumam responder em até 1 dia
-
good first issue
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 95/100
omarelshamy25x/shamy-hijri#63 ·
Mantenedores costumam responder em até 1 dia