@@ -52,7 +52,7 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
5252
5353from os import stat
5454from time import sleep
55- from typing import List, Optional, Tuple
55+ from typing import List, Optional, Tuple, Dict
5656
5757import openshift as oc
5858from ray.job_submission import JobSubmissionClient
@@ -77,6 +77,8 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
7777 Note that currently, the underlying implementation is a Ray cluster.
7878 """
7979
80+ torchx_scheduler = "ray"
81+
8082 def __init__(self, config: ClusterConfiguration):
8183 """
8284 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>
222224 if status == CodeFlareClusterStatus.UNKNOWN:
223225 pretty_print.print_no_resources_found()
224226 else:
225- pretty_print.print_app_wrappers_status([appwrapper])
227+ pretty_print.print_app_wrappers_status([appwrapper], starting=True )
226228
227229 return status, ready
228230
@@ -300,6 +302,20 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.cluster</code></h1>
300302 client = JobSubmissionClient(dashboard_route)
301303 return client.get_job_logs(job_id)
302304
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+
303319
304320def get_current_namespace() -> str:
305321 """
@@ -621,6 +637,8 @@ <h2 class="section-title" id="header-classes">Classes</h2>
621637 Note that currently, the underlying implementation is a Ray cluster.
622638 """
623639
640+ torchx_scheduler = "ray"
641+
624642 def __init__(self, config: ClusterConfiguration):
625643 """
626644 Create the resource cluster object by passing in a ClusterConfiguration
@@ -766,7 +784,7 @@ <h2 class="section-title" id="header-classes">Classes</h2>
766784 if status == CodeFlareClusterStatus.UNKNOWN:
767785 pretty_print.print_no_resources_found()
768786 else:
769- pretty_print.print_app_wrappers_status([appwrapper])
787+ pretty_print.print_app_wrappers_status([appwrapper], starting=True )
770788
771789 return status, ready
772790
@@ -842,8 +860,29 @@ <h2 class="section-title" id="header-classes">Classes</h2>
842860 """
843861 dashboard_route = self.cluster_dashboard_uri()
844862 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 >
846878</ 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 >
847886< h3 > Methods</ h3 >
848887< dl >
849888< dt id ="codeflare_sdk.cluster.cluster.Cluster.cluster_dashboard_uri "> < code class ="name flex ">
@@ -1022,7 +1061,7 @@ <h3>Methods</h3>
10221061</ details >
10231062</ dd >
10241063< 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 >
10261065</ code > </ dt >
10271066< dd >
10281067< 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>
11061145 if status == CodeFlareClusterStatus.UNKNOWN:
11071146 pretty_print.print_no_resources_found()
11081147 else:
1109- pretty_print.print_app_wrappers_status([appwrapper])
1148+ pretty_print.print_app_wrappers_status([appwrapper], starting=True )
11101149
11111150 return status, ready</ code > </ pre >
11121151</ details >
11131152</ 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 >
11141177< dt id ="codeflare_sdk.cluster.cluster.Cluster.up "> < code class ="name flex ">
11151178< span > def < span class ="ident "> up</ span > </ span > (< span > self)</ span >
11161179</ code > </ dt >
@@ -1209,6 +1272,8 @@ <h4><code><a title="codeflare_sdk.cluster.cluster.Cluster" href="#codeflare_sdk.
12091272< li > < code > < a title ="codeflare_sdk.cluster.cluster.Cluster.job_status " href ="#codeflare_sdk.cluster.cluster.Cluster.job_status "> job_status</ a > </ code > </ li >
12101273< li > < code > < a title ="codeflare_sdk.cluster.cluster.Cluster.list_jobs " href ="#codeflare_sdk.cluster.cluster.Cluster.list_jobs "> list_jobs</ a > </ code > </ li >
12111274< 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 >
12121277< li > < code > < a title ="codeflare_sdk.cluster.cluster.Cluster.up " href ="#codeflare_sdk.cluster.cluster.Cluster.up "> up</ a > </ code > </ li >
12131278< li > < code > < a title ="codeflare_sdk.cluster.cluster.Cluster.wait_ready " href ="#codeflare_sdk.cluster.cluster.Cluster.wait_ready "> wait_ready</ a > </ code > </ li >
12141279</ ul >
0 commit comments