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

handle mismatch between brain and metacurriculum #3034

Merged
merged 7 commits into from
Dec 12, 2019

Conversation

chriselion
Copy link
Contributor

@chriselion chriselion commented Dec 5, 2019

  • Having a brain that doesn't have a curriculum results in a KeyError in trainer_util.py (amongst other places). This is probably a setup error, but we should at least be more forgiving.
  • Having a curriculum that doesn't have a brain results in KeyErrors in trainer_controller.py (amongst other places). Seems like this could happen pretty easily for a stale config, or a brain that hasn't connected yet.

Tested manually by renaming a WallJump curriculum file, also added unit tests.

@@ -32,9 +32,9 @@ def __init__(self, curriculum_folder: str):
try:
for curriculum_filename in os.listdir(curriculum_folder):
# This process requires JSON files
if not curriculum_filename.lower().endswith(".json"):
brain_name, extension = os.path.splitext(curriculum_filename)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

So far I don't think this has tripped anybody up. But the old behavior would mean that a brain with a . in the name wouldn't be able to match up with the metacurriculum, because curriculum_filename.split(".")[0] would take the only the filename up to the first . instead of the last one.

@chriselion chriselion requested a review from ervteng December 12, 2019 02:23
Copy link
Contributor

@ervteng ervteng left a comment

Choose a reason for hiding this comment

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

Looks good!

Oh wait, except for the failing tests.

@chriselion chriselion merged commit 68779b4 into master Dec 12, 2019
@delete-merged-branch delete-merged-branch bot deleted the develop-MLA-396-better-errors branch December 12, 2019 17:48
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants