Skip to content
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

Fix ABC usage issues #317

Merged
merged 1 commit into from
Jan 6, 2025
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
7 changes: 3 additions & 4 deletions src/cloudai/_core/command_gen_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from abc import abstractmethod
from abc import ABC, abstractmethod

from .test_scenario import TestRun
from .test_template_strategy import TestTemplateStrategy


class CommandGenStrategy(TestTemplateStrategy):
class CommandGenStrategy(TestTemplateStrategy, ABC):
"""
Abstract base class defining the interface for command generation strategies across different system environments.

Expand Down Expand Up @@ -53,7 +53,6 @@ def gen_srun_command(self, tr: TestRun) -> str:
"""
pass

@abstractmethod
def gen_srun_success_check(self, tr: TestRun) -> str:
"""
Generate the Slurm success check command to verify if a test run was successful.
Expand All @@ -64,4 +63,4 @@ def gen_srun_success_check(self, tr: TestRun) -> str:
Returns:
str: The generated command to check the success of the test run.
"""
pass
return ""
4 changes: 2 additions & 2 deletions src/cloudai/_core/json_gen_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
# limitations under the License.

import re
from abc import abstractmethod
from abc import ABC, abstractmethod
from typing import Any, Dict

from .test_scenario import TestRun
from .test_template_strategy import TestTemplateStrategy


class JsonGenStrategy(TestTemplateStrategy):
class JsonGenStrategy(TestTemplateStrategy, ABC):
"""
Abstract base class for generating Kubernetes job specifications based on system and test parameters.

Expand Down
2 changes: 1 addition & 1 deletion src/cloudai/_core/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ class CmdArgs(BaseModel):
model_config = ConfigDict(extra="forbid")


class TestDefinition(BaseModel):
class TestDefinition(BaseModel, ABC):
"""Base Test object."""

__test__ = False
Expand Down
Loading