Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature / Request History options #1141

Merged
merged 14 commits into from Nov 2, 2023
Merged

Feature / Request History options #1141

merged 14 commits into from Nov 2, 2023

Conversation

jlnav
Copy link
Member

@jlnav jlnav commented Oct 23, 2023

Addresses #1103

New options plus their defaults:

    save_H_on_completion: Optional[bool] = False
    """ Save state of ``H`` to file upon completing a workflow."""

    save_H_with_date: Optional[bool] = False
    """ ``H`` filename contains date and timestamp."""

    H_file_prefix: Optional[str] = "libE_history"
    """ Prefix for ``H`` filename."""

@jlnav jlnav requested review from shuds13 and AngelFP October 23, 2023 17:12
Copy link
Contributor

@AngelFP AngelFP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this @jlnav!
I have given it a try and it works very well. There's only an additional comment I have, which is that the file saved on completion has a different name than those saved every k steps. Ideally this wouldn't be the case, because then we always have two history files after an optimas run (e.g., exploration_history_after_sim_20.npy and exploration_history_after_completion.npy).

One possible solution that I see would be a final call to

if self.libE_specs.get("save_every_k_sims"):
    self._save_every_k_sims()
if self.libE_specs.get("save_every_k_gens"):
    self._save_every_k_gens()

if "save_H_on_completion" is enabled. This would probably require a force=True argument in _save_every_k to make sure that the final history is saved.

@jlnav
Copy link
Member Author

jlnav commented Oct 24, 2023

Thanks for this @jlnav! I have given it a try and it works very well. There's only an additional comment I have, which is that the file saved on completion has a different name than those saved every k steps. Ideally this wouldn't be the case, because then we always have two history files after an optimas run (e.g., exploration_history_after_sim_20.npy and exploration_history_after_completion.npy).

One possible solution that I see would be a final call to

if self.libE_specs.get("save_every_k_sims"):
    self._save_every_k_sims()
if self.libE_specs.get("save_every_k_gens"):
    self._save_every_k_gens()

if "save_H_on_completion" is enabled. This would probably require a force=True argument in _save_every_k to make sure that the final history is saved.

Sounds good, thanks! I can make that change right away.

…filenames should be identical to normal save_every_k files
Copy link
Contributor

@AngelFP AngelFP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works great now :D

@shuds13
Copy link
Member

shuds13 commented Oct 26, 2023

If save_H_on_completion defaults to True, what stops you from getting two .npy files at the end, when user is dumping their file already? We need to agree on defaults.

One consideration is multiple calls to libE, they might only want to dump at the end.

@jlnav jlnav merged commit 7b2e780 into develop Nov 2, 2023
9 of 11 checks passed
@jlnav jlnav deleted the feature/history_opts branch November 2, 2023 15:01
@shuds13 shuds13 mentioned this pull request Nov 2, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants