Skip to content

Commit

Permalink
Fix hydra-auto-schema pydantic serialization issue (#98)
Browse files Browse the repository at this point in the history
Signed-off-by: Fabrice Normandin <[email protected]>
  • Loading branch information
lebrice authored Dec 6, 2024
1 parent 2a3ac85 commit 91dde96
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
11 changes: 9 additions & 2 deletions project/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,14 +231,21 @@ def test_fast_dev_run(experiment_dictconfig: DictConfig):
assert isinstance(result["value"], float)


@pytest.mark.xfail(reason="TODO: cluster sweep example causes pydantic serialization error")
def test_run_auto_schema_via_cli_without_errors():
"""Checks that the command completes without errors."""
# Run programmatically instead of with a subprocess so we can get nice coverage stats.
# assuming we're at the project root directory.
from hydra_auto_schema.__main__ import main as hydra_auto_schema_main

hydra_auto_schema_main([str(CONFIG_DIR), "--stop-on-error", "-vv"])
hydra_auto_schema_main(
[
f"{REPO_ROOTDIR}",
f"--configs_dir={CONFIG_DIR}",
"--stop-on-error",
"--regen-schemas",
"-vv",
]
)


# TODO: Add some more integration tests:
Expand Down
5 changes: 3 additions & 2 deletions project/utils/remote_launcher_plugin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# https://github.com/facebookresearch/hydra/blob/main/examples/plugins/example_launcher_plugin/hydra_plugins/example_launcher_plugin/example_launcher.py

import dataclasses
Expand Down Expand Up @@ -60,7 +59,9 @@ def _instantiate(self: Plugins, config: DictConfig) -> Plugin:
Plugins._instantiate = _instantiate


@dataclasses.dataclass(init=False)
# Made this a dataclass to avoid having an ugly default repr, but it causes issues with
# hydra-auto-schema because it tries to create a schema for everything here.
# @dataclasses.dataclass(init=False)
class RemoteSlurmLauncher(BaseSubmititLauncher):
_EXECUTOR: ClassVar[str] = "remoteslurm"

Expand Down

0 comments on commit 91dde96

Please sign in to comment.