Skip to content

Conversation

@ronald-jaepel
Copy link
Contributor

@ronald-jaepel ronald-jaepel commented Apr 19, 2025

Hashing now excludes keys:

  • starting with _ or
  • containing __ or
  • listed in {"commit_message", "push", "debug", "force"}.

Key removal is recursive.

For logs of old cadet-RDM repositories, OutputRepo.update_log_hashes can bring the log up to date.

@ronald-jaepel
Copy link
Contributor Author

I've currently got a cold and a fever, so this PR might be a bit messy. Let me know if this solves your options problem from #33 and then we can merge.

@schmoelder
Copy link
Contributor

Thanks for the quick fix. Unfortunately, I now get the following error when calling case.run_study()

  File ~/code/CADET-RDM/cadetrdm/batch_running/case.py:185 in run_study
    if not force and self.has_results_for_this_run:

  File ~/code/CADET-RDM/cadetrdm/batch_running/case.py:93 in has_results_for_this_run
    self.results_branch = self._get_results_branch()

  File ~/code/CADET-RDM/cadetrdm/batch_running/case.py:116 in _get_results_branch
    for output_branch, log_entry in output_log.items()[::-1]:

TypeError: 'dict_items' object is not subscriptable

@schmoelder
Copy link
Contributor

I suggest

for output_branch, log_entry in reversed(output_log.items()):

@schmoelder
Copy link
Contributor

Just realized that this wasn't even part of this PR....

Copy link
Contributor Author

@ronald-jaepel ronald-jaepel left a comment

Choose a reason for hiding this comment

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

Cool! Again what learned :)

@schmoelder
Copy link
Contributor

unfortunately, the self.output_repo.update_log_hashes() seems to ignore the Case.status attribute which leads to crashes every time I want to run multiple studies / cases at once.

self.fix_gitattributes_log_tsv()
if version_sum < 1007:
warnings.warn("Repo version has outdated options hashes. Updating option hashes in output log.tsv.")
self.output_repo.update_log_hashes()
Copy link
Contributor

Choose a reason for hiding this comment

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

don't we need to set the changes_were_made flag here, too? Otherwise, it will never actually update the version number and always try to update the log hashes.

@ronald-jaepel
Copy link
Contributor Author

To document our insight from Discord:
changes_were_made was not set to True, so the version number of the repo was not bumped.
After that I was afraid it would not work, because it would re-do the fix because v0.1.6 is still <0.1.7, so I created a pre-release. @schmoelder correctly identified that that isn't necessary as the version update section is only performed if if self._metadata["cadet_rdm_version"] != cadetrdm.__version__:.

entry.options_hash = options.get_hash()

self.checkout(self.main_branch)
log.write()
Copy link
Contributor

@schmoelder schmoelder Apr 24, 2025

Choose a reason for hiding this comment

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

This crashes if len(log.entries) == 0 (i.e. a repo that has never been run).

ronald-jaepel and others added 4 commits April 28, 2025 11:28
now excludes keys starting with _, containing __ or listed in {"commit_message", "push", "debug", "force"}.
Key removal is recursive.
For logs of old cadet-RDM repositories, OutputRepo.update_log_hashes can bring the log up to date.
@ronald-jaepel ronald-jaepel force-pushed the change_options_hashing branch from ecf5e98 to a839080 Compare April 28, 2025 09:29
@ronald-jaepel ronald-jaepel merged commit d78fa9c into master Apr 28, 2025
5 checks passed
@ronald-jaepel ronald-jaepel deleted the change_options_hashing branch April 28, 2025 09:29
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.

3 participants