Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion torchx/specs/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,15 @@ def _apply_nested(self, d: typing.Dict[str, Any]) -> typing.Dict[str, Any]:
v[i] = self.substitute(v[i])
return d

# Overrides the asdict method to generate a dictionary of macro values to be substituted.
def to_dict(self) -> Dict[str, Any]:
return asdict(self)

def substitute(self, arg: str) -> str:
"""
substitute applies the values to the template arg.
"""
return Template(arg).safe_substitute(**asdict(self))
return Template(arg).safe_substitute(**self.to_dict())


class RetryPolicy(str, Enum):
Expand Down
Loading