-
Couldn't load subscription status.
- Fork 38
[1092] Using MLFlow in the main repo #1127
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
Draft
tjhunter
wants to merge
6
commits into
develop
Choose a base branch
from
tjh/dev/1092_mlflow
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| """ | ||
| Platform environment configuration for WeatherGenerator. | ||
|
|
||
| These are loaded from secrets in the private repository. | ||
| """ | ||
|
|
||
| import importlib | ||
| from pathlib import Path | ||
| from typing import Protocol | ||
| from omegaconf import OmegaConf | ||
| from weathergen.common.config import _REPO_ROOT | ||
| from functools import lru_cache | ||
|
|
||
|
|
||
| class PlatformEnv(Protocol): | ||
| """ | ||
| Interface for platform environment configuration. | ||
| """ | ||
|
|
||
| def get_hpc(self) -> str | None: | ||
| ... | ||
|
|
||
| def get_hpc_user(self) -> str | None: | ||
| ... | ||
|
|
||
| def get_hpc_config(self) -> str | None: | ||
| ... | ||
|
|
||
| def get_hpc_certificate(self) -> str | None: | ||
| ... | ||
|
|
||
|
|
||
| # def get_private_conf() -> OmegaConf: | ||
| # """ | ||
| # Loads the private configuration from the private repository. | ||
| # Excludes secrets. | ||
|
|
||
| # In doudbt, use this function. | ||
| # """ | ||
|
|
||
|
|
||
| @lru_cache(maxsize=1) | ||
| def get_platform_env() -> PlatformEnv: | ||
| """ | ||
| Loads the platform environment module from the private repository. | ||
| """ | ||
| env_script_path = _REPO_ROOT.parent / "WeatherGenerator-private" / "hpc" / "platform-env.py" | ||
| spec = importlib.util.spec_from_file_location("platform_env", env_script_path) | ||
| platform_env = importlib.util.module_from_spec(spec) | ||
| spec.loader.exec_module(platform_env) # type: ignore | ||
| return platform_env | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| print(f"Loaded platform environment: {env.get_hpc()}") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| [project] | ||
| name = "weathergen-metrics" | ||
| version = "0.1.0" | ||
| description = "The WeatherGenerator Machine Learning Earth System Model" | ||
| readme = "../../README.md" | ||
| requires-python = ">=3.12,<3.13" | ||
| dependencies = [ | ||
| "mlflow", | ||
| "weathergen-common", | ||
| ] | ||
|
|
||
| [dependency-groups] | ||
| dev = [ | ||
| "pytest~=8.3.5", | ||
| "pytest-mock>=3.14.1", | ||
| "ruff==0.9.7", | ||
| "pyrefly==0.33.0", | ||
| ] | ||
|
|
||
|
|
||
| [tool.pyrefly] | ||
| project-includes = ["src/"] | ||
| project-excludes = [ | ||
| ] | ||
|
|
||
| [tool.pyrefly.errors] | ||
| bad-argument-type = false | ||
| unsupported-operation = false | ||
| missing-attribute = false | ||
| no-matching-overload = false | ||
| bad-context-manager = false | ||
|
|
||
| # To do: | ||
| bad-assignment = false | ||
| bad-return = false | ||
| index-error = false | ||
| not-iterable = false | ||
| not-callable = false | ||
|
|
||
|
|
||
|
|
||
|
|
||
| # The linting configuration | ||
| [tool.ruff] | ||
|
|
||
| # Wide rows | ||
| line-length = 100 | ||
|
|
||
| [tool.ruff.lint] | ||
| # All disabled until the code is formatted. | ||
| select = [ | ||
| # pycodestyle | ||
| "E", | ||
| # Pyflakes | ||
| "F", | ||
| # pyupgrade | ||
| "UP", | ||
| # flake8-bugbear | ||
| "B", | ||
| # flake8-simplify | ||
| "SIM", | ||
| # isort | ||
| "I", | ||
| # Banned imports | ||
| "TID", | ||
| # Naming conventions | ||
| "N", | ||
| "T201" | ||
| ] | ||
|
|
||
| # These rules are sensible and should be enabled at a later stage. | ||
| ignore = [ | ||
| # "B006", | ||
| "B011", | ||
| "UP008", | ||
| "SIM117", | ||
| "SIM118", | ||
| "SIM102", | ||
| "SIM401", | ||
| # To ignore, not relevant for us | ||
| "SIM108", # in case additional norm layer supports are added in future | ||
| "N817", # we use heavy acronyms, e.g., allowing 'import LongModuleName as LMN' (LMN is accepted) | ||
| "E731", # overly restrictive and less readable code | ||
| "N812", # prevents us following the convention for importing torch.nn.functional as F | ||
| ] | ||
|
|
||
| [tool.ruff.lint.flake8-tidy-imports.banned-api] | ||
| "numpy.ndarray".msg = "Do not use 'ndarray' to describe a numpy array type, it is a function. Use numpy.typing.NDArray or numpy.typing.NDArray[np.float32] for example" | ||
|
|
||
| [tool.ruff.format] | ||
| # Use Unix `\n` line endings for all files | ||
| line-ending = "lf" | ||
|
|
||
|
|
||
|
|
||
| [build-system] | ||
| requires = ["hatchling"] | ||
| build-backend = "hatchling.build" | ||
|
|
||
| [tool.hatch.build.targets.wheel] | ||
| packages = ["src/weathergen"] | ||
Empty file.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe mlflow-skinny would work