Skip to content

Commit

Permalink
Avoid duplicated runs during W&B publication (#484)
Browse files Browse the repository at this point in the history
Co-authored-by: Evgeny Pavlov <[email protected]>
  • Loading branch information
vrigal and eu9ene authored Mar 19, 2024
1 parent 8646fc6 commit fb9531f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tracking/translations_parser/cli/taskcluster_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from collections import defaultdict
from pathlib import Path

import wandb
import yaml

import taskcluster
Expand Down Expand Up @@ -265,6 +266,16 @@ def publish_task_group(group_id: str) -> None:
)

# Group and publish remaining metrics tasks via the logs publication
if (
len(
wandb.Api().runs(
project_name, filters={"display_name": "group_logs", "group": group_name}
)
)
> 0
):
logger.warning("Skipping group_logs fake run publication as it already exists")
return
with tempfile.TemporaryDirectory() as temp_dir:
logs_folder = Path(temp_dir) / "logs"
eval_folder = logs_folder / project_name / group_name / "eval"
Expand Down
15 changes: 15 additions & 0 deletions tracking/translations_parser/publishers.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,21 @@ def open(self, parser) -> None:
self.parser = parser
config = parser.config
config.update(self.extra_kwargs.pop("config", {}))

# Ensure no W&B run already exists
if name := self.extra_kwargs.get("name"):
existing_runs = list(
wandb.Api().runs(
self.project,
filters={"display_name": name, "group": self.extra_kwargs.get("group")},
)
)
if len(existing_runs) > 0:
logger.warning(
f"This run already exists on W&B: {existing_runs}. No data will be published."
)
return

# Start a W&B run
try:
self.wandb = wandb.init(
Expand Down

0 comments on commit fb9531f

Please sign in to comment.