Skip to content

Commit

Permalink
Deploying to gh-pages from @ 7a5c611 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
richard-rogers committed Oct 1, 2024
1 parent c322351 commit 19492c0
Show file tree
Hide file tree
Showing 41 changed files with 1,849 additions and 1,535 deletions.
Binary file removed _images/whylabs.png
Binary file not shown.
29 changes: 25 additions & 4 deletions _modules/whylogs/api/whylabs/session/config.html
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ <h1>Source code for whylogs.api.whylabs.session.config</h1><div class="highlight
<span class="n">prompt_default_dataset_id</span><span class="p">,</span>
<span class="n">prompt_org_id</span><span class="p">,</span>
<span class="n">prompt_session_type</span><span class="p">,</span>
<span class="n">prompt_upload_on_log</span><span class="p">,</span>
<span class="p">)</span>
<span class="kn">from</span> <span class="nn">whylogs.api.whylabs.session.session_types</span> <span class="kn">import</span> <span class="n">ApiKeyV1</span><span class="p">,</span> <span class="n">ApiKeyV2</span>
<span class="kn">from</span> <span class="nn">whylogs.api.whylabs.session.session_types</span> <span class="kn">import</span> <span class="n">InteractiveLogger</span> <span class="k">as</span> <span class="n">il</span>
Expand Down Expand Up @@ -511,10 +512,11 @@ <h1>Source code for whylogs.api.whylabs.session.config</h1><div class="highlight
<span class="k">class</span> <span class="nc">InitConfig</span><span class="p">:</span>
<span class="n">whylabs_api_key</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>
<span class="n">allow_anonymous</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span>
<span class="n">allow_local</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span>
<span class="n">allow_local</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">True</span>
<span class="n">default_dataset_id</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>
<span class="n">config_path</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>
<span class="n">force_local</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></div>
<span class="n">force_local</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span>
<span class="n">upload_on_log</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">bool</span><span class="p">]</span> <span class="o">=</span> <span class="kc">None</span></div>


<div class="viewcode-block" id="SessionConfig"><a class="viewcode-back" href="../../../../../api/whylogs/api/whylabs/session/config/index.html#whylogs.api.whylabs.session.config.SessionConfig">[docs]</a><span class="k">class</span> <span class="nc">SessionConfig</span><span class="p">:</span>
Expand All @@ -535,8 +537,10 @@ <h1>Source code for whylogs.api.whylabs.session.config</h1><div class="highlight
<span class="k">if</span> <span class="n">force_interactive</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">reset_config</span><span class="p">()</span>
<span class="bp">self</span><span class="o">.</span><span class="n">session_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_determine_session_type_prompt</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_init_config</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">upload_on_log</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_determine_upload_on_log_prompt</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_init_config</span><span class="p">)</span>
<span class="k">else</span><span class="p">:</span>
<span class="bp">self</span><span class="o">.</span><span class="n">session_type</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_determine_session_type</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_init_config</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">upload_on_log</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">_determine_upload_on_log</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">_init_config</span><span class="p">)</span>

<span class="k">def</span> <span class="nf">_init_parser</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
<span class="k">try</span><span class="p">:</span>
Expand Down Expand Up @@ -799,7 +803,8 @@ <h1>Source code for whylogs.api.whylabs.session.config</h1><div class="highlight
<span class="p">)</span>

<span class="k">def</span> <span class="nf">_determine_session_type_prompt</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">init_config</span><span class="p">:</span> <span class="n">InitConfig</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">SessionType</span><span class="p">:</span>
<span class="n">session_type</span> <span class="o">=</span> <span class="n">prompt_session_type</span><span class="p">(</span><span class="n">init_config</span><span class="o">.</span><span class="n">allow_anonymous</span><span class="p">,</span> <span class="n">init_config</span><span class="o">.</span><span class="n">allow_local</span><span class="p">)</span>
<span class="n">allow_local</span> <span class="o">=</span> <span class="n">init_config</span><span class="o">.</span><span class="n">allow_local</span> <span class="ow">and</span> <span class="n">init_config</span><span class="o">.</span><span class="n">upload_on_log</span> <span class="ow">in</span> <span class="p">{</span><span class="kc">None</span><span class="p">,</span> <span class="kc">False</span><span class="p">}</span>
<span class="n">session_type</span> <span class="o">=</span> <span class="n">prompt_session_type</span><span class="p">(</span><span class="n">init_config</span><span class="o">.</span><span class="n">allow_anonymous</span><span class="p">,</span> <span class="n">allow_local</span><span class="p">)</span>
<span class="k">if</span> <span class="n">session_type</span> <span class="o">==</span> <span class="n">SessionType</span><span class="o">.</span><span class="n">WHYLABS</span><span class="p">:</span>
<span class="n">api_key</span> <span class="o">=</span> <span class="n">prompt_api_key</span><span class="p">()</span>

Expand Down Expand Up @@ -849,7 +854,23 @@ <h1>Source code for whylogs.api.whylabs.session.config</h1><div class="highlight
<span class="s2">&quot;Don&#39;t know how to initialize authentication because allow_anonymous=False, allow_local=False, &quot;</span>
<span class="s2">&quot;and there is no WhyLabs api key in the environment, config file, or why.init() call, and this isn&#39;t an &quot;</span>
<span class="sa">f</span><span class="s2">&quot;interactive environment. See </span><span class="si">{</span><span class="n">INIT_DOCS</span><span class="si">}</span><span class="s2"> for instructions on using why.init().&quot;</span>
<span class="p">)</span></div>
<span class="p">)</span>

<span class="k">def</span> <span class="nf">_determine_upload_on_log_prompt</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">init_config</span><span class="p">:</span> <span class="n">InitConfig</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span>
<span class="k">if</span> <span class="n">init_config</span><span class="o">.</span><span class="n">upload_on_log</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="k">return</span> <span class="n">init_config</span><span class="o">.</span><span class="n">upload_on_log</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">session_type</span> <span class="o">!=</span> <span class="n">SessionType</span><span class="o">.</span><span class="n">LOCAL</span>

<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">session_type</span> <span class="o">!=</span> <span class="n">SessionType</span><span class="o">.</span><span class="n">LOCAL</span> <span class="ow">and</span> <span class="n">prompt_upload_on_log</span><span class="p">()</span>

<span class="k">def</span> <span class="nf">_determine_upload_on_log</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">init_config</span><span class="p">:</span> <span class="n">InitConfig</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span>
<span class="k">if</span> <span class="n">init_config</span><span class="o">.</span><span class="n">force_local</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">session_type</span> <span class="o">==</span> <span class="n">SessionType</span><span class="o">.</span><span class="n">LOCAL</span><span class="p">:</span>
<span class="k">return</span> <span class="kc">False</span>

<span class="c1"># If we&#39;re in an interactive environment then prompt the user to pick upload on log</span>
<span class="k">if</span> <span class="n">is_interractive</span><span class="p">()</span> <span class="ow">and</span> <span class="n">init_config</span><span class="o">.</span><span class="n">upload_on_log</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
<span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">_determine_upload_on_log_prompt</span><span class="p">(</span><span class="n">init_config</span><span class="p">)</span>

<span class="k">return</span> <span class="n">init_config</span><span class="o">.</span><span class="n">upload_on_log</span> <span class="ow">or</span> <span class="kc">False</span></div>


<span class="n">_CONFIG_WHYLABS_SECTION</span> <span class="o">=</span> <span class="s2">&quot;whylabs&quot;</span>
Expand Down
9 changes: 9 additions & 0 deletions _modules/whylogs/api/whylabs/session/prompts.html
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,15 @@ <h1>Source code for whylogs.api.whylabs.session.prompts</h1><div class="highligh
<span class="k">return</span> <span class="p">[</span><span class="n">SessionType</span><span class="o">.</span><span class="n">WHYLABS</span><span class="p">,</span> <span class="n">SessionType</span><span class="o">.</span><span class="n">WHYLABS_ANONYMOUS</span><span class="p">,</span> <span class="n">SessionType</span><span class="o">.</span><span class="n">LOCAL</span><span class="p">][</span><span class="n">choice</span> <span class="o">-</span> <span class="mi">1</span><span class="p">]</span></div>


<div class="viewcode-block" id="prompt_upload_on_log"><a class="viewcode-back" href="../../../../../api/whylogs/api/whylabs/session/prompts/index.html#whylogs.api.whylabs.session.prompts.prompt_upload_on_log">[docs]</a><span class="k">def</span> <span class="nf">prompt_upload_on_log</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span>
<span class="n">options</span> <span class="o">=</span> <span class="p">[</span>
<span class="s2">&quot;No. Use an explicit WhyLabsWriter to manage uploads to WhyLabs&quot;</span><span class="p">,</span>
<span class="s2">&quot;Yes. Calling why.log() will automatically upload the results to WhyLabs&quot;</span><span class="p">,</span>
<span class="p">]</span>
<span class="n">choice</span> <span class="o">=</span> <span class="n">_get_user_choice</span><span class="p">(</span><span class="s2">&quot;Do you want to automatically upload profiles in why.log()?&quot;</span><span class="p">,</span> <span class="n">options</span><span class="p">)</span>
<span class="k">return</span> <span class="p">[</span><span class="kc">False</span><span class="p">,</span> <span class="kc">True</span><span class="p">][</span><span class="n">choice</span> <span class="o">-</span> <span class="mi">1</span><span class="p">]</span></div>


<div class="viewcode-block" id="prompt_default_dataset_id"><a class="viewcode-back" href="../../../../../api/whylogs/api/whylabs/session/prompts/index.html#whylogs.api.whylabs.session.prompts.prompt_default_dataset_id">[docs]</a><span class="k">def</span> <span class="nf">prompt_default_dataset_id</span><span class="p">()</span> <span class="o">-&gt;</span> <span class="n">Optional</span><span class="p">[</span><span class="nb">str</span><span class="p">]:</span>
<span class="k">try</span><span class="p">:</span>
<span class="n">sys</span><span class="o">.</span><span class="n">stdout</span><span class="o">.</span><span class="n">flush</span><span class="p">()</span>
Expand Down
6 changes: 4 additions & 2 deletions _modules/whylogs/api/whylabs/session/session.html
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,9 @@ <h1>Source code for whylogs.api.whylabs.session.session</h1><div class="highligh
<div class="viewcode-block" id="ApiKeySession.upload_reference_profiles"><a class="viewcode-back" href="../../../../../api/whylogs/api/whylabs/session/session/index.html#whylogs.api.whylabs.session.session.ApiKeySession.upload_reference_profiles">[docs]</a> <span class="k">def</span> <span class="nf">upload_reference_profiles</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">profile_aliases</span><span class="p">:</span> <span class="n">Dict</span><span class="p">[</span><span class="nb">str</span><span class="p">,</span> <span class="n">ResultSet</span><span class="p">])</span> <span class="o">-&gt;</span> <span class="n">Union</span><span class="p">[</span><span class="n">UploadResult</span><span class="p">,</span> <span class="n">NotSupported</span><span class="p">]:</span>
<span class="n">results</span><span class="p">:</span> <span class="n">List</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
<span class="k">for</span> <span class="n">alias</span><span class="p">,</span> <span class="n">profile</span> <span class="ow">in</span> <span class="n">profile_aliases</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
<span class="n">success</span><span class="p">,</span> <span class="n">ids</span> <span class="o">=</span> <span class="n">profile</span><span class="o">.</span><span class="n">writer</span><span class="p">(</span><span class="s2">&quot;whylabs&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">option</span><span class="p">(</span><span class="n">reference_profile_name</span><span class="o">=</span><span class="n">alias</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">()</span>
<span class="n">success</span><span class="p">,</span> <span class="n">ids</span> <span class="o">=</span> <span class="p">(</span>
<span class="n">profile</span><span class="o">.</span><span class="n">writer</span><span class="p">(</span><span class="s2">&quot;whylabs&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">_option</span><span class="p">(</span><span class="n">call_from_log</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="o">.</span><span class="n">option</span><span class="p">(</span><span class="n">reference_profile_name</span><span class="o">=</span><span class="n">alias</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">()</span>
<span class="p">)</span>
<span class="k">if</span> <span class="n">success</span><span class="p">:</span>
<span class="n">ids</span> <span class="o">=</span> <span class="n">ids</span> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">ids</span><span class="p">,</span> <span class="nb">list</span><span class="p">)</span> <span class="k">else</span> <span class="p">[(</span><span class="kc">True</span><span class="p">,</span> <span class="n">ids</span><span class="p">)]</span>
<span class="n">results</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="o">*</span><span class="p">[</span><span class="nb">id</span> <span class="k">for</span> <span class="n">_</span><span class="p">,</span> <span class="nb">id</span> <span class="ow">in</span> <span class="n">ids</span><span class="p">])</span>
Expand All @@ -746,7 +748,7 @@ <h1>Source code for whylogs.api.whylabs.session.session</h1><div class="highligh
<span class="p">)</span></div>

<div class="viewcode-block" id="ApiKeySession.upload_batch_profile"><a class="viewcode-back" href="../../../../../api/whylogs/api/whylabs/session/session/index.html#whylogs.api.whylabs.session.session.ApiKeySession.upload_batch_profile">[docs]</a> <span class="k">def</span> <span class="nf">upload_batch_profile</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">profile</span><span class="p">:</span> <span class="n">ResultSet</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Union</span><span class="p">[</span><span class="n">UploadResult</span><span class="p">,</span> <span class="n">NotSupported</span><span class="p">]:</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">profile</span><span class="o">.</span><span class="n">writer</span><span class="p">(</span><span class="s2">&quot;whylabs&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">()</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">profile</span><span class="o">.</span><span class="n">writer</span><span class="p">(</span><span class="s2">&quot;whylabs&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">_option</span><span class="p">(</span><span class="n">call_from_log</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="o">.</span><span class="n">write</span><span class="p">()</span>
<span class="n">utc_now</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">datetime</span><span class="o">.</span><span class="n">now</span><span class="p">(</span><span class="n">timezone</span><span class="o">.</span><span class="n">utc</span><span class="p">)</span><span class="o">.</span><span class="n">timestamp</span><span class="p">()</span> <span class="o">*</span> <span class="mi">1000</span><span class="p">)</span>
<span class="n">timestamps</span><span class="p">:</span> <span class="n">Set</span><span class="p">[</span><span class="nb">int</span><span class="p">]</span> <span class="o">=</span> <span class="nb">set</span><span class="p">()</span> <span class="c1"># For generating the viewing url after upload</span>

Expand Down
Loading

0 comments on commit 19492c0

Please sign in to comment.