1+
2+
3+ <!DOCTYPE html>
4+ < html class ="writer-html5 " lang ="en " data-content_root ="../../../../ ">
5+ < head >
6+ < meta charset ="utf-8 " />
7+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 " />
8+ < title > codeflare_sdk.common.utils.demos — CodeFlare SDK 0.31.1 documentation</ title >
9+ < link rel ="stylesheet " type ="text/css " href ="../../../../_static/pygments.css?v=b86133f3 " />
10+ < link rel ="stylesheet " type ="text/css " href ="../../../../_static/css/theme.css?v=e59714d7 " />
11+
12+
13+ < script src ="../../../../_static/jquery.js?v=5d32c60e "> </ script >
14+ < script src ="../../../../_static/_sphinx_javascript_frameworks_compat.js?v=2cd50e6c "> </ script >
15+ < script src ="../../../../_static/documentation_options.js?v=72479337 "> </ script >
16+ < script src ="../../../../_static/doctools.js?v=9a2dae69 "> </ script >
17+ < script src ="../../../../_static/sphinx_highlight.js?v=dc90522c "> </ script >
18+ < script src ="../../../../_static/js/theme.js "> </ script >
19+ < link rel ="index " title ="Index " href ="../../../../genindex.html " />
20+ < link rel ="search " title ="Search " href ="../../../../search.html " />
21+ </ head >
22+
23+ < body class ="wy-body-for-nav ">
24+ < div class ="wy-grid-for-nav ">
25+ < nav data-toggle ="wy-nav-shift " class ="wy-nav-side ">
26+ < div class ="wy-side-scroll ">
27+ < div class ="wy-side-nav-search " >
28+
29+
30+
31+ < a href ="../../../../index.html " class ="icon icon-home ">
32+ CodeFlare SDK
33+ </ a >
34+ < div role ="search ">
35+ < form id ="rtd-search-form " class ="wy-form " action ="../../../../search.html " method ="get ">
36+ < input type ="text " name ="q " placeholder ="Search docs " aria-label ="Search docs " />
37+ < input type ="hidden " name ="check_keywords " value ="yes " />
38+ < input type ="hidden " name ="area " value ="default " />
39+ </ form >
40+ </ div >
41+ </ div > < div class ="wy-menu wy-menu-vertical " data-spy ="affix " role ="navigation " aria-label ="Navigation menu ">
42+ < p class ="caption " role ="heading "> < span class ="caption-text "> Code Documentation:</ span > </ p >
43+ < ul >
44+ < li class ="toctree-l1 "> < a class ="reference internal " href ="../../../../modules.html "> codeflare_sdk</ a > </ li >
45+ </ ul >
46+ < p class ="caption " role ="heading "> < span class ="caption-text "> User Documentation:</ span > </ p >
47+ < ul >
48+ < li class ="toctree-l1 "> < a class ="reference internal " href ="../../../../user-docs/authentication.html "> Authentication via the CodeFlare SDK</ a > </ li >
49+ < li class ="toctree-l1 "> < a class ="reference internal " href ="../../../../user-docs/cluster-configuration.html "> Ray Cluster Configuration</ a > </ li >
50+ < li class ="toctree-l1 "> < a class ="reference internal " href ="../../../../user-docs/ray-cluster-interaction.html "> Ray Cluster Interaction</ a > </ li >
51+ < li class ="toctree-l1 "> < a class ="reference internal " href ="../../../../user-docs/e2e.html "> Running e2e tests locally</ a > </ li >
52+ < li class ="toctree-l1 "> < a class ="reference internal " href ="../../../../user-docs/s3-compatible-storage.html "> S3 compatible storage with Ray Train examples</ a > </ li >
53+ < li class ="toctree-l1 "> < a class ="reference internal " href ="../../../../user-docs/setup-kueue.html "> Basic Kueue Resources configuration</ a > </ li >
54+ < li class ="toctree-l1 "> < a class ="reference internal " href ="../../../../user-docs/ui-widgets.html "> Jupyter UI Widgets</ a > </ li >
55+ </ ul >
56+
57+ </ div >
58+ </ div >
59+ </ nav >
60+
61+ < section data-toggle ="wy-nav-shift " class ="wy-nav-content-wrap "> < nav class ="wy-nav-top " aria-label ="Mobile navigation menu " >
62+ < i data-toggle ="wy-nav-top " class ="fa fa-bars "> </ i >
63+ < a href ="../../../../index.html "> CodeFlare SDK</ a >
64+ </ nav >
65+
66+ < div class ="wy-nav-content ">
67+ < div class ="rst-content ">
68+ < div role ="navigation " aria-label ="Page navigation ">
69+ < ul class ="wy-breadcrumbs ">
70+ < li > < a href ="../../../../index.html " class ="icon icon-home " aria-label ="Home "> </ a > </ li >
71+ < li class ="breadcrumb-item "> < a href ="../../../index.html "> Module code</ a > </ li >
72+ < li class ="breadcrumb-item active "> codeflare_sdk.common.utils.demos</ li >
73+ < li class ="wy-breadcrumbs-aside ">
74+ </ li >
75+ </ ul >
76+ < hr />
77+ </ div >
78+ < div role ="main " class ="document " itemscope ="itemscope " itemtype ="http://schema.org/Article ">
79+ < div itemprop ="articleBody ">
80+
81+ < h1 > Source code for codeflare_sdk.common.utils.demos</ h1 > < div class ="highlight "> < pre >
82+ < span > </ span > < span class ="kn "> import</ span > < span class ="w "> </ span > < span class ="nn "> pathlib</ span >
83+ < span class ="kn "> import</ span > < span class ="w "> </ span > < span class ="nn "> shutil</ span >
84+
85+ < span class ="n "> package_dir</ span > < span class ="o "> =</ span > < span class ="n "> pathlib</ span > < span class ="o "> .</ span > < span class ="n "> Path</ span > < span class ="p "> (</ span > < span class ="vm "> __file__</ span > < span class ="p "> )</ span > < span class ="o "> .</ span > < span class ="n "> parent</ span > < span class ="o "> .</ span > < span class ="n "> parent</ span > < span class ="o "> .</ span > < span class ="n "> parent</ span > < span class ="o "> .</ span > < span class ="n "> resolve</ span > < span class ="p "> ()</ span >
86+ < span class ="n "> demo_dir</ span > < span class ="o "> =</ span > < span class ="sa "> f</ span > < span class ="s2 "> "</ span > < span class ="si "> {</ span > < span class ="n "> package_dir</ span > < span class ="si "> }</ span > < span class ="s2 "> /demo-notebooks"</ span >
87+
88+
89+ < div class ="viewcode-block " id ="copy_demo_nbs ">
90+ < a class ="viewcode-back " href ="../../../../codeflare_sdk.common.utils.html#codeflare_sdk.common.utils.demos.copy_demo_nbs "> [docs]</ a >
91+ < span class ="k "> def</ span > < span class ="w "> </ span > < span class ="nf "> copy_demo_nbs</ span > < span class ="p "> (</ span > < span class ="nb "> dir</ span > < span class ="p "> :</ span > < span class ="nb "> str</ span > < span class ="o "> =</ span > < span class ="s2 "> "./demo-notebooks"</ span > < span class ="p "> ,</ span > < span class ="n "> overwrite</ span > < span class ="p "> :</ span > < span class ="nb "> bool</ span > < span class ="o "> =</ span > < span class ="kc "> False</ span > < span class ="p "> ):</ span >
92+ < span class ="w "> </ span > < span class ="sd "> """</ span >
93+ < span class ="sd "> Copy the demo notebooks from the package to the current working directory</ span >
94+
95+ < span class ="sd "> overwrite=True will overwrite any files that exactly match files written by copy_demo_nbs in the target directory.</ span >
96+ < span class ="sd "> Any files that exist in the directory that don't match these values will remain untouched.</ span >
97+
98+ < span class ="sd "> Args:</ span >
99+ < span class ="sd "> dir (str):</ span >
100+ < span class ="sd "> The directory to copy the demo notebooks to. Defaults to "./demo-notebooks".</ span >
101+ < span class ="sd "> overwrite (bool):</ span >
102+ < span class ="sd "> Whether to overwrite files in the directory if it already exists. Defaults to False.</ span >
103+
104+ < span class ="sd "> Raises:</ span >
105+ < span class ="sd "> FileExistsError:</ span >
106+ < span class ="sd "> If the directory already exists.</ span >
107+ < span class ="sd "> """</ span >
108+ < span class ="c1 "> # does dir exist already?</ span >
109+ < span class ="k "> if</ span > < span class ="n "> overwrite</ span > < span class ="ow "> is</ span > < span class ="kc "> False</ span > < span class ="ow "> and</ span > < span class ="n "> pathlib</ span > < span class ="o "> .</ span > < span class ="n "> Path</ span > < span class ="p "> (</ span > < span class ="nb "> dir</ span > < span class ="p "> )</ span > < span class ="o "> .</ span > < span class ="n "> exists</ span > < span class ="p "> ():</ span >
110+ < span class ="k "> raise</ span > < span class ="ne "> FileExistsError</ span > < span class ="p "> (</ span >
111+ < span class ="sa "> f</ span > < span class ="s2 "> "Directory </ span > < span class ="si "> {</ span > < span class ="nb "> dir</ span > < span class ="si "> }</ span > < span class ="s2 "> already exists. Please remove it or provide a different location."</ span >
112+ < span class ="p "> )</ span >
113+
114+ < span class ="n "> shutil</ span > < span class ="o "> .</ span > < span class ="n "> copytree</ span > < span class ="p "> (</ span > < span class ="n "> demo_dir</ span > < span class ="p "> ,</ span > < span class ="nb "> dir</ span > < span class ="p "> ,</ span > < span class ="n "> dirs_exist_ok</ span > < span class ="o "> =</ span > < span class ="kc "> True</ span > < span class ="p "> )</ span > </ div >
115+
116+ </ pre > </ div >
117+
118+ </ div >
119+ </ div >
120+ < footer >
121+
122+ < hr />
123+
124+ < div role ="contentinfo ">
125+ < p > © Copyright 2024, Project CodeFlare.</ p >
126+ </ div >
127+
128+ Built with < a href ="https://www.sphinx-doc.org/ "> Sphinx</ a > using a
129+ < a href ="https://github.com/readthedocs/sphinx_rtd_theme "> theme</ a >
130+ provided by < a href ="https://readthedocs.org "> Read the Docs</ a > .
131+
132+
133+ </ footer >
134+ </ div >
135+ </ div >
136+ </ section >
137+ </ div >
138+ < script >
139+ jQuery ( function ( ) {
140+ SphinxRtdTheme . Navigation . enable ( true ) ;
141+ } ) ;
142+ </ script >
143+
144+ </ body >
145+ </ html >
0 commit comments