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

Compatibility-breaking change in hydra 1.1.0dev7 #52

Merged
merged 8 commits into from
May 12, 2021
Merged

Conversation

rsokl
Copy link
Contributor

@rsokl rsokl commented May 11, 2021

This is the culprit:

facebookresearch/hydra#1581

It looks like Hydra has support for callbacks now. I don't have very deep insight into how it works yet.

@jgbos I took a swing at fixing the compatibility-breaking change, but definitely take a look at their changes yourself. I am not confident that my "fix" is totally general / appropriate!

Note that run_job now also accepts an optional hydra_context argument. It looks like we need to pass it a context:

  tests/experimental/test_validation.py: 4 warnings
    /home/runner/work/hydra-zen/hydra-zen/.tox/py/lib/python3.9/site-packages/hydra/core/utils.py:94: UserWarning: 
    run_job's signature has changed in Hydra 1.1. Please pass in hydra_context.
    Support for the old style will be removed in Hydra 1.2.
    For more info, check https://github.com/facebookresearch/hydra/pull/1581.
      warnings.warn(

It also looks like hydra.initialize() should be passed a config_path in _load_config() (although it looks like it is valid to / we may want to just pass None)

  tests/experimental/test_implementations.py: 55 warnings
  tests/experimental/test_validation.py: 10 warnings
    /home/runner/work/hydra-zen/hydra-zen/.tox/py/lib/python3.9/site-packages/hydra_zen/experimental/_implementations.py:81: UserWarning: config_path is not specified in hydra.initialize().
    See https://hydra.cc/docs/next/upgrades/1.0_to_1.1/changes_to_hydra_main_config_path for more information.
      with initialize():

Some other things:

  • I updated deprecated imports from hydra.experimental.
  • I removed an interpolation utility that I wrote but that we never used / started failing a test.

@rsokl rsokl requested a review from jgbos May 11, 2021 03:54
config=task_cfg,
task_function=task_function,
job_dir_key="hydra.run.dir",
job_subdir_key=None,
configure_logging=False,
)

callbacks.on_run_end(config=task_cfg, config_name=config_name, job_return=job)
Copy link
Contributor Author

@rsokl rsokl May 11, 2021

Choose a reason for hiding this comment

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

@jgbos it doesn't look like .on_run_end() necessarily accepts job_return; it looks like .on_job_end() does (which we don't have to worry about).

Is there a specific reason why you specified this in our case?

Copy link
Contributor

Choose a reason for hiding this comment

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

i just copied that from one of hydra's test cases

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm.. Well I'm thinking we may want to remove it in case it creates any issues with callbacks that don't expect it

Copy link
Contributor

Choose a reason for hiding this comment

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

oh whoops, i misread that, I was thinking it was in the test. The code came from Hydra's code:

https://github.com/facebookresearch/hydra/blob/master/hydra/_internal/hydra.py#L107

Probably best to just stick with the signature in the abstract method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah! Hmm that might be worth adding back in then just so that we mirror them. Good catch / sleuthing!

@rsokl rsokl marked this pull request as ready for review May 12, 2021 01:16
@rsokl rsokl merged commit 6110e22 into main May 12, 2021
@rsokl rsokl deleted the compat-hydra-1.1.0dev7 branch May 12, 2021 01:16
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.

2 participants