Skip to content

specs: add ROLE restart policy #936

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions torchx/specs/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,14 @@ class RetryPolicy(str, Enum):
is not violated using extra hosts as spares. It does not really support
elasticity and just uses the delta between num_replicas and min_replicas
as spares (EXPERIMENTAL).
4. ROLE: Restarts the role when any error occurs in that role. This does not
restart the whole job.
"""

REPLICA = "REPLICA"
APPLICATION = "APPLICATION"
HOT_SPARE = "HOT_SPARE"
ROLE = "ROLE"


class MountType(str, Enum):
Expand Down
11 changes: 11 additions & 0 deletions torchx/specs/test/api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,17 @@ def test_build_role(self) -> None:
self.assertEqual(5, trainer.max_retries)
self.assertEqual(RetryPolicy.REPLICA, trainer.retry_policy)

def test_retry_policies(self) -> None:
self.assertCountEqual(
set(RetryPolicy), # pyre-ignore[6]: Enum isn't iterable
{
RetryPolicy.APPLICATION,
RetryPolicy.REPLICA,
RetryPolicy.ROLE,
RetryPolicy.HOT_SPARE,
},
)


class AppHandleTest(unittest.TestCase):
def test_parse_malformed_app_handles(self) -> None:
Expand Down
Loading