File tree Expand file tree Collapse file tree 2 files changed +27
-5
lines changed
src/codeflare_sdk/cluster Expand file tree Collapse file tree 2 files changed +27
-5
lines changed Original file line number Diff line number Diff line change 42
42
RayCluster ,
43
43
RayClusterStatus ,
44
44
)
45
- from .widgets import cluster_up_down_buttons , is_notebook
45
+ from .widgets import (
46
+ cluster_up_down_buttons ,
47
+ is_notebook ,
48
+ wait_ready_check_box ,
49
+ )
46
50
from kubernetes import client , config
47
51
from kubernetes .utils import parse_quantity
48
52
import yaml
@@ -173,16 +177,23 @@ def up(self):
173
177
174
178
def _cluster_up_down_buttons (self ):
175
179
up_button , delete_button = cluster_up_down_buttons (self .config .appwrapper )
180
+ wait_ready_check = wait_ready_check_box ()
176
181
output = widgets .Output ()
177
- # Display the buttons in an HBox
178
- display (widgets .HBox ([up_button , delete_button ]), output )
179
182
180
- def on_up_button_clicked (b ):
183
+ # Display the buttons in an HBox wrapped in a VBox which includes the wait_ready Checkbox
184
+ button_display = widgets .HBox ([up_button , delete_button ])
185
+ display (widgets .VBox ([button_display , wait_ready_check ]), output )
186
+
187
+ def on_up_button_clicked (b ): # Handle the up button click event
181
188
with output :
182
189
output .clear_output ()
183
190
self .up ()
184
191
185
- def on_down_button_clicked (b ):
192
+ # If the wait_ready Checkbox is clicked(value == True) trigger the wait_ready function
193
+ if wait_ready_check .value :
194
+ self .wait_ready ()
195
+
196
+ def on_down_button_clicked (b ): # Handle the down button click event
186
197
with output :
187
198
output .clear_output ()
188
199
self .down ()
Original file line number Diff line number Diff line change @@ -43,6 +43,17 @@ def cluster_up_down_buttons(appwrapper: bool) -> widgets.Button:
43
43
return up_button , delete_button
44
44
45
45
46
+ def wait_ready_check_box ():
47
+ """
48
+ The wait_ready_check_box function will return a checkbox widget used for waiting for the resource to be in the state READY.
49
+ """
50
+ wait_ready_check_box = widgets .Checkbox (
51
+ False ,
52
+ description = "Wait for Cluster?" ,
53
+ )
54
+ return wait_ready_check_box
55
+
56
+
46
57
def is_notebook () -> bool :
47
58
"""
48
59
The is_notebook function checks if Jupyter Notebook environment variables exist in the given environment and return True/False based on that.
You can’t perform that action at this time.
0 commit comments