Skip to content

Commit

Permalink
Internal
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 720607527
  • Loading branch information
Grain Team authored and copybara-github committed Jan 28, 2025
1 parent 21ed6f3 commit c42ce44
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions grain/_src/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,11 @@ def __getattr__(self, name: str) -> Any:
flag_name = f"grain_{name}"
if any(f.name == flag_name for f in _GRAIN_FLAGS):
value = getattr(flags.FLAGS, flag_name)
enrolled = int(
bool(value) if value is None or isinstance(value, str) else value
)
_grain_experiment_metric.Set(enrolled, flag_name)
if isinstance(value, int):
int_value = value
else:
int_value = int(value != flags.FLAGS[flag_name].default)
_grain_experiment_metric.Set(int_value, flag_name)
return value
raise ValueError(f"Unrecognized config option: {name}")

Expand Down

0 comments on commit c42ce44

Please sign in to comment.