Skip to content

Commit

Permalink
More ways to not find an artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkgr committed May 30, 2024
1 parent dba77f4 commit 562a920
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions tango/integrations/wandb/util.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import re
import warnings
from enum import Enum

Expand All @@ -13,11 +14,17 @@ def is_missing_artifact_error(err: WandbError):
Check if a specific W&B error is caused by a 404 on the artifact we're looking for.
"""
# This is brittle, but at least we have a test for it.
return (
("does not contain artifact" in err.message)
or ("Unable to fetch artifact with name" in err.message)
or (err.message == "'NoneType' object has no attribute 'get'")
) # This is a workaround for a bug in the wandb API

# This is a workaround for a bug in the wandb API
if err.message == "'NoneType' object has no attribute 'get'":
return True

if re.search(r"^artifact '.*' not found in '.*'$", err.message):
return True

return ("does not contain artifact" in err.message) or (
"Unable to fetch artifact with name" in err.message
)


def check_environment():
Expand Down

0 comments on commit 562a920

Please sign in to comment.