@@ -52,7 +52,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
52
52
53
53
from os import stat
54
54
from time import sleep
55
- from typing import List, Optional, Tuple
55
+ from typing import List, Optional, Tuple, Dict
56
56
57
57
import openshift as oc
58
58
from ray.job_submission import JobSubmissionClient
@@ -77,6 +77,8 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
77
77
Note that currently, the underlying implementation is a Ray cluster.
78
78
"""
79
79
80
+ torchx_scheduler = "ray"
81
+
80
82
def __init__(self, config: ClusterConfiguration):
81
83
"""
82
84
Create the resource cluster object by passing in a ClusterConfiguration
@@ -222,7 +224,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
222
224
if status == CodeFlareClusterStatus.UNKNOWN:
223
225
pretty_print.print_no_resources_found()
224
226
else:
225
- pretty_print.print_app_wrappers_status([appwrapper])
227
+ pretty_print.print_app_wrappers_status([appwrapper], starting=True )
226
228
227
229
return status, ready
228
230
@@ -300,6 +302,20 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
300
302
client = JobSubmissionClient(dashboard_route)
301
303
return client.get_job_logs(job_id)
302
304
305
+ def torchx_config(
306
+ self, working_dir: str = None, requirements: str = None
307
+ ) -> Dict[str, str]:
308
+ dashboard_address = f"{self.cluster_dashboard_uri().lstrip('http://')}"
309
+ to_return = {
310
+ "cluster_name": self.config.name,
311
+ "dashboard_address": dashboard_address,
312
+ }
313
+ if working_dir:
314
+ to_return["working_dir"] = working_dir
315
+ if requirements:
316
+ to_return["requirements"] = requirements
317
+ return to_return
318
+
303
319
304
320
def get_current_namespace() -> str:
305
321
"""
@@ -621,6 +637,8 @@ <h2 class="section-title" id="header-classes">Classes</h2>
621
637
Note that currently, the underlying implementation is a Ray cluster.
622
638
"""
623
639
640
+ torchx_scheduler = "ray"
641
+
624
642
def __init__(self, config: ClusterConfiguration):
625
643
"""
626
644
Create the resource cluster object by passing in a ClusterConfiguration
@@ -766,7 +784,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
766
784
if status == CodeFlareClusterStatus.UNKNOWN:
767
785
pretty_print.print_no_resources_found()
768
786
else:
769
- pretty_print.print_app_wrappers_status([appwrapper])
787
+ pretty_print.print_app_wrappers_status([appwrapper], starting=True )
770
788
771
789
return status, ready
772
790
@@ -842,8 +860,29 @@ <h2 class="section-title" id="header-classes">Classes</h2>
842
860
"""
843
861
dashboard_route = self.cluster_dashboard_uri()
844
862
client = JobSubmissionClient(dashboard_route)
845
- return client.get_job_logs(job_id)</ code > </ pre >
863
+ return client.get_job_logs(job_id)
864
+
865
+ def torchx_config(
866
+ self, working_dir: str = None, requirements: str = None
867
+ ) -> Dict[str, str]:
868
+ dashboard_address = f"{self.cluster_dashboard_uri().lstrip('http://')}"
869
+ to_return = {
870
+ "cluster_name": self.config.name,
871
+ "dashboard_address": dashboard_address,
872
+ }
873
+ if working_dir:
874
+ to_return["working_dir"] = working_dir
875
+ if requirements:
876
+ to_return["requirements"] = requirements
877
+ return to_return</ code > </ pre >
846
878
</ details >
879
+ < h3 > Class variables</ h3 >
880
+ < dl >
881
+ < dt id ="codeflare_sdk.cluster.cluster.Cluster.torchx_scheduler "> < code class ="name "> var < span class ="ident "> torchx_scheduler</ span > </ code > </ dt >
882
+ < dd >
883
+ < div class ="desc "> </ div >
884
+ </ dd >
885
+ </ dl >
847
886
< h3 > Methods</ h3 >
848
887
< dl >
849
888
< dt id ="codeflare_sdk.cluster.cluster.Cluster.cluster_dashboard_uri "> < code class ="name flex ">
@@ -1022,7 +1061,7 @@ <h3>Methods</h3>
1022
1061
</ details >
1023
1062
</ dd >
1024
1063
< dt id ="codeflare_sdk.cluster.cluster.Cluster.list_jobs "> < code class ="name flex ">
1025
- < span > def < span class ="ident "> list_jobs</ span > </ span > (< span > self) ‑> List</ span >
1064
+ < span > def < span class ="ident "> list_jobs</ span > </ span > (< span > self) ‑> List[~T] </ span >
1026
1065
</ code > </ dt >
1027
1066
< dd >
1028
1067
< div class ="desc "> < p > This method accesses the head ray node in your cluster and lists the running jobs.</ p > </ div >
@@ -1106,11 +1145,35 @@ <h3>Methods</h3>
1106
1145
if status == CodeFlareClusterStatus.UNKNOWN:
1107
1146
pretty_print.print_no_resources_found()
1108
1147
else:
1109
- pretty_print.print_app_wrappers_status([appwrapper])
1148
+ pretty_print.print_app_wrappers_status([appwrapper], starting=True )
1110
1149
1111
1150
return status, ready</ code > </ pre >
1112
1151
</ details >
1113
1152
</ dd >
1153
+ < dt id ="codeflare_sdk.cluster.cluster.Cluster.torchx_config "> < code class ="name flex ">
1154
+ < span > def < span class ="ident "> torchx_config</ span > </ span > (< span > self, working_dir: str = None, requirements: str = None) ‑> Dict[str, str]</ span >
1155
+ </ code > </ dt >
1156
+ < dd >
1157
+ < div class ="desc "> </ div >
1158
+ < details class ="source ">
1159
+ < summary >
1160
+ < span > Expand source code</ span >
1161
+ </ summary >
1162
+ < pre > < code class ="python "> def torchx_config(
1163
+ self, working_dir: str = None, requirements: str = None
1164
+ ) -> Dict[str, str]:
1165
+ dashboard_address = f"{self.cluster_dashboard_uri().lstrip('http://')}"
1166
+ to_return = {
1167
+ "cluster_name": self.config.name,
1168
+ "dashboard_address": dashboard_address,
1169
+ }
1170
+ if working_dir:
1171
+ to_return["working_dir"] = working_dir
1172
+ if requirements:
1173
+ to_return["requirements"] = requirements
1174
+ return to_return</ code > </ pre >
1175
+ </ details >
1176
+ </ dd >
1114
1177
< dt id ="codeflare_sdk.cluster.cluster.Cluster.up "> < code class ="name flex ">
1115
1178
< span > def < span class ="ident "> up</ span > </ span > (< span > self)</ span >
1116
1179
</ code > </ dt >
@@ -1209,6 +1272,8 @@ <h4><code><a title="codeflare_sdk.cluster.cluster.Cluster" href="#codeflare_sdk.
1209
1272
< li > < code > < a title ="codeflare_sdk.cluster.cluster.Cluster.job_status " href ="#codeflare_sdk.cluster.cluster.Cluster.job_status "> job_status</ a > </ code > </ li >
1210
1273
< li > < code > < a title ="codeflare_sdk.cluster.cluster.Cluster.list_jobs " href ="#codeflare_sdk.cluster.cluster.Cluster.list_jobs "> list_jobs</ a > </ code > </ li >
1211
1274
< li > < code > < a title ="codeflare_sdk.cluster.cluster.Cluster.status " href ="#codeflare_sdk.cluster.cluster.Cluster.status "> status</ a > </ code > </ li >
1275
+ < li > < code > < a title ="codeflare_sdk.cluster.cluster.Cluster.torchx_config " href ="#codeflare_sdk.cluster.cluster.Cluster.torchx_config "> torchx_config</ a > </ code > </ li >
1276
+ < li > < code > < a title ="codeflare_sdk.cluster.cluster.Cluster.torchx_scheduler " href ="#codeflare_sdk.cluster.cluster.Cluster.torchx_scheduler "> torchx_scheduler</ a > </ code > </ li >
1212
1277
< li > < code > < a title ="codeflare_sdk.cluster.cluster.Cluster.up " href ="#codeflare_sdk.cluster.cluster.Cluster.up "> up</ a > </ code > </ li >
1213
1278
< li > < code > < a title ="codeflare_sdk.cluster.cluster.Cluster.wait_ready " href ="#codeflare_sdk.cluster.cluster.Cluster.wait_ready "> wait_ready</ a > </ code > </ li >
1214
1279
</ ul >
0 commit comments