Skip to content

Commit

Permalink
[doc_push][main] built from 4081bcc (main). Redirects: main -> 0.8.0d…
Browse files Browse the repository at this point in the history
…ev0.
  • Loading branch information
TorchX CI Runner committed Jul 23, 2024
1 parent 4f36e7a commit 9905812
Show file tree
Hide file tree
Showing 12 changed files with 747 additions and 859 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
30 changes: 27 additions & 3 deletions 0.8.0dev0/_modules/torchx/schedulers/kubernetes_scheduler.html
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,17 @@ <h1>Source code for torchx.schedulers.kubernetes_scheduler</h1><div class="highl

<span class="n">LABEL_INSTANCE_TYPE</span> <span class="o">=</span> <span class="s2">&quot;node.kubernetes.io/instance-type&quot;</span>

<span class="c1"># role.env translates to static env variables in the yaml</span>
<span class="c1"># {&quot;FOO&quot; : &quot;bar&quot;} =====&gt; - name: FOO</span>
<span class="c1"># value: bar</span>
<span class="c1"># unless this placeholder is present at the start of the role.env value then the env variable</span>
<span class="c1"># in the yaml will be dynamically populated at runtime (placeholder is stripped out of the value)</span>
<span class="c1"># {&quot;FOO&quot; : &quot;[FIELD_PATH]bar&quot;} =====&gt; - name: FOO</span>
<span class="c1"># valueFrom:</span>
<span class="c1"># fieldRef:</span>
<span class="c1"># fieldPath: bar</span>
<span class="n">PLACEHOLDER_FIELD_PATH</span> <span class="o">=</span> <span class="s2">&quot;[FIELD_PATH]&quot;</span>


<div class="viewcode-block" id="sanitize_for_serialization"><a class="viewcode-back" href="../../../schedulers/kubernetes.html#torchx.schedulers.kubernetes_scheduler.sanitize_for_serialization">[docs]</a><span class="k">def</span> <span class="nf">sanitize_for_serialization</span><span class="p">(</span><span class="n">obj</span><span class="p">:</span> <span class="nb">object</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">object</span><span class="p">:</span>
<span class="kn">from</span> <span class="nn">kubernetes</span> <span class="kn">import</span> <span class="n">client</span>
Expand All @@ -624,7 +635,9 @@ <h1>Source code for torchx.schedulers.kubernetes_scheduler</h1><div class="highl
<span class="n">V1ContainerPort</span><span class="p">,</span>
<span class="n">V1EmptyDirVolumeSource</span><span class="p">,</span>
<span class="n">V1EnvVar</span><span class="p">,</span>
<span class="n">V1EnvVarSource</span><span class="p">,</span>
<span class="n">V1HostPathVolumeSource</span><span class="p">,</span>
<span class="n">V1ObjectFieldSelector</span><span class="p">,</span>
<span class="n">V1ObjectMeta</span><span class="p">,</span>
<span class="n">V1PersistentVolumeClaimVolumeSource</span><span class="p">,</span>
<span class="n">V1Pod</span><span class="p">,</span>
Expand Down Expand Up @@ -744,9 +757,20 @@ <h1>Source code for torchx.schedulers.kubernetes_scheduler</h1><div class="highl
<span class="n">image</span><span class="o">=</span><span class="n">role</span><span class="o">.</span><span class="n">image</span><span class="p">,</span>
<span class="n">name</span><span class="o">=</span><span class="n">name</span><span class="p">,</span>
<span class="n">env</span><span class="o">=</span><span class="p">[</span>
<span class="n">V1EnvVar</span><span class="p">(</span>
<span class="n">name</span><span class="o">=</span><span class="n">name</span><span class="p">,</span>
<span class="n">value</span><span class="o">=</span><span class="n">value</span><span class="p">,</span>
<span class="p">(</span>
<span class="n">V1EnvVar</span><span class="p">(</span>
<span class="n">name</span><span class="o">=</span><span class="n">name</span><span class="p">,</span>
<span class="n">value_from</span><span class="o">=</span><span class="n">V1EnvVarSource</span><span class="p">(</span>
<span class="n">field_ref</span><span class="o">=</span><span class="n">V1ObjectFieldSelector</span><span class="p">(</span>
<span class="n">field_path</span><span class="o">=</span><span class="n">value</span><span class="o">.</span><span class="n">strip</span><span class="p">(</span><span class="n">PLACEHOLDER_FIELD_PATH</span><span class="p">)</span>
<span class="p">)</span>
<span class="p">),</span>
<span class="p">)</span>
<span class="k">if</span> <span class="n">value</span><span class="o">.</span><span class="n">startswith</span><span class="p">(</span><span class="n">PLACEHOLDER_FIELD_PATH</span><span class="p">)</span>
<span class="k">else</span> <span class="n">V1EnvVar</span><span class="p">(</span>
<span class="n">name</span><span class="o">=</span><span class="n">name</span><span class="p">,</span>
<span class="n">value</span><span class="o">=</span><span class="n">value</span><span class="p">,</span>
<span class="p">)</span>
<span class="p">)</span>
<span class="k">for</span> <span class="n">name</span><span class="p">,</span> <span class="n">value</span> <span class="ow">in</span> <span class="n">role</span><span class="o">.</span><span class="n">env</span><span class="o">.</span><span class="n">items</span><span class="p">()</span>
<span class="p">],</span>
Expand Down
Loading

0 comments on commit 9905812

Please sign in to comment.