Skip to content

Commit 12c2327

Browse files
authored
moving to models (#3)
* appwrapper status implemented * moved model to its own file Co-authored-by: Atin Sood <[email protected]>
1 parent c5a50ed commit 12c2327

File tree

4 files changed

+24
-25
lines changed

4 files changed

+24
-25
lines changed

src/codeflare_sdk/cluster/cluster.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from .config import ClusterConfiguration
2-
from ..utils.pretty_print import RayCluster, AppWrapper
2+
from .model import RayCluster, AppWrapper
33
from ..utils import pretty_print
44
import openshift as oc
55
from typing import List, Optional
@@ -14,6 +14,8 @@ def up(self):
1414
pass
1515

1616
def down(self, name):
17+
# FIXME on what the exact details should be
18+
# 1. delete the appwrapper and that should delete the cluster
1719
# FIXME on what the exact details should be
1820
# 1. delete the appwrapper and that should delete the cluster
1921
pass
@@ -42,7 +44,7 @@ def _get_appwrappers(namespace='default'):
4244
app_wrappers = oc.selector('appwrappers').qnames()
4345
return app_wrappers
4446

45-
47+
4648
def _app_wrapper_status(name, namespace='default') -> Optional[AppWrapper]:
4749
with oc.project(namespace), oc.timeout(10*60):
4850
cluster = oc.selector(f'appwrapper/{name}').object()

src/codeflare_sdk/cluster/model.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from dataclasses import dataclass
2+
3+
@dataclass
4+
class RayCluster:
5+
name: str
6+
status: str
7+
min_workers: int
8+
max_workers: int
9+
worker_mem_min: str
10+
worker_mem_max: str
11+
worker_cpu: int
12+
worker_gpu: int
13+
14+
@dataclass
15+
class AppWrapper:
16+
name: str
17+
status:str
18+
can_run: bool
19+
job_state: str

src/codeflare_sdk/utils/pretty_print.py

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,11 @@
1-
from ast import Str
2-
from turtle import st
31
from rich import print
42
from rich.table import Table
53
from rich.console import Console
64
from rich.layout import Layout
75
from rich.panel import Panel
86
from rich import box
9-
from dataclasses import dataclass
107
from typing import List
11-
12-
@dataclass
13-
class RayCluster:
14-
name: str
15-
status: str
16-
min_workers: int
17-
max_workers: int
18-
worker_mem_min: str
19-
worker_mem_max: str
20-
worker_cpu: int
21-
worker_gpu: int
22-
23-
@dataclass
24-
class AppWrapper:
25-
name: str
26-
status:str
27-
can_run: bool
28-
job_state: str
29-
8+
from ..cluster.model import RayCluster, AppWrapper
309

3110
def _print_no_cluster_found():
3211
pass

tests/test_clusters.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,3 @@ def test_cluster_status():
1212
def test_app_wrapper_status():
1313
print(_app_wrapper_status('raycluster-autoscaler'))
1414

15-

0 commit comments

Comments
 (0)