Skip to content

Commit

Permalink
Increase MLflow HTTP retry (ecmwf#111)
Browse files Browse the repository at this point in the history
* feat: increase mlflow http retry and timeout

* chore: changelog

* feat: reduce values

* feat: update values for 1 hour of downtime

* refactor: set env vars before mlflow import

* chore: formatting

* Update CHANGELOG.md
  • Loading branch information
gmertes authored Nov 18, 2024
1 parent d0f2035 commit 23fd045
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Keep it human-readable, your future self will thank you!
### Changed
## [0.3.0 - Loss & Callback Refactors](https://github.com/ecmwf/anemoi-training/compare/0.2.2...0.3.0) - 2024-11-14

### Changed
- Increase the default MlFlow HTTP max retries [#111](https://github.com/ecmwf/anemoi-training/pull/111)

### Fixed

- Rename loss_scaling to variable_loss_scaling [#138](https://github.com/ecmwf/anemoi-training/pull/138)
Expand Down
10 changes: 10 additions & 0 deletions src/anemoi/training/diagnostics/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from __future__ import annotations

import logging
import os
from pathlib import Path
from typing import TYPE_CHECKING

Expand All @@ -27,6 +28,15 @@ def get_mlflow_logger(config: DictConfig) -> None:
LOGGER.debug("MLFlow logging is disabled.")
return None

# 35 retries allow for 1 hour of server downtime
http_max_retries = config.diagnostics.log.mlflow.get("http_max_retries", 35)

os.environ["MLFLOW_HTTP_REQUEST_MAX_RETRIES"] = str(http_max_retries)
os.environ["_MLFLOW_HTTP_REQUEST_MAX_RETRIES_LIMIT"] = str(http_max_retries + 1)
# these are the default values, but set them explicitly in case they change
os.environ["MLFLOW_HTTP_REQUEST_BACKOFF_FACTOR"] = "2"
os.environ["MLFLOW_HTTP_REQUEST_BACKOFF_JITTER"] = "1"

from anemoi.training.diagnostics.mlflow.logger import AnemoiMLflowLogger

resumed = config.training.run_id is not None
Expand Down

0 comments on commit 23fd045

Please sign in to comment.