Skip to content

Commit

Permalink
Update unreleased documentation (#627)
Browse files Browse the repository at this point in the history
* Update versions.json

* Deployed 44140a2 to unreleased in versions with MkDocs 1.5.3 and mike 2.0.0

* Sort docs versions

---------

Co-authored-by: GitHub Actions Bot <[email protected]>
  • Loading branch information
github-actions[bot] and GitHub Actions Bot authored Feb 16, 2024
1 parent 52f7910 commit b889e65
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9407,7 +9407,7 @@ <h2 id="sending-and-receiving-input-at-runtime">Sending and receiving input at r
</ul>
<div class="admonition type">
<p class="admonition-title">When to use a <code>BaseModel</code> or <code>RunInput</code> instead of a built-in type</p>
<p>Most built-in types and collections of built-in types should work with <code>send_input</code> and <code>receive_input</code>, but there is a caveat with nested collection types, such as lists of tuples, e.g. <code>List[Tuple[str, float]])</code>. In this case, validation may happen after your flow receives the data, so calling <code>receive_input</code> may raise a <code>ValidationError</code>. You can plan to catch this exception, but also, consider placing the field in an explicit <code>BaseModel</code> or <code>RunInput</code> so that your flow only receives exact type matches. </p>
<p>Most built-in types and collections of built-in types should work with <code>send_input</code> and <code>receive_input</code>, but there is a caveat with nested collection types, such as lists of tuples, e.g. <code>List[Tuple[str, float]])</code>. In this case, validation may happen after your flow receives the data, so calling <code>receive_input</code> may raise a <code>ValidationError</code>. You can plan to catch this exception, but also, consider placing the field in an explicit <code>BaseModel</code> or <code>RunInput</code> so that your flow only receives exact type matches.</p>
</div>
<p>Let's look at some examples! We'll check out <code>receive_input</code> first, followed by <code>send_input</code>, and then we'll see the two functions working together.</p>
<h3 id="receiving-input">Receiving input<a class="headerlink" href="#receiving-input" title="Permanent link">&para;</a></h3>
Expand Down Expand Up @@ -9602,7 +9602,7 @@ <h3 id="responding-to-the-inputs-sender">Responding to the input's sender<a clas
<span class="k">return</span>
<span class="k">await</span> <span class="n">name_input</span><span class="o">.</span><span class="n">respond</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;Hello, </span><span class="si">{</span><span class="n">name_input</span><span class="o">.</span><span class="n">value</span><span class="si">}</span><span class="s2">!&quot;</span><span class="p">)</span>
</code></pre></div>
<p>With a <code>greeter</code> flow in place, now we're ready to create the flow that sends <code>greeter</code> names!</p>
<p>With a <code>greeter</code> flow in place, we're ready to create the flow that sends <code>greeter</code> names!</p>
<h3 id="sending-input">Sending input<a class="headerlink" href="#sending-input" title="Permanent link">&para;</a></h3>
<p>You can send input to a flow with the <code>send_input</code> function. This works similarly to <code>receive_input</code> and, like that function, accepts the same <code>run_input</code> argument, which can be a built-in type such as <code>str</code>, or else a <code>BaseModel</code> or <code>RunInput</code> subclass.</p>
<div class="admonition note">
Expand Down Expand Up @@ -9728,16 +9728,13 @@ <h3 id="seeing-a-complete-example">Seeing a complete example<a class="headerlink
<span class="k">elif</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span> <span class="o">==</span> <span class="s2">&quot;sender&quot;</span><span class="p">:</span>
<span class="n">asyncio</span><span class="o">.</span><span class="n">run</span><span class="p">(</span><span class="n">sender</span><span class="p">())</span>
</code></pre></div>
<p>To run the example, you'll need a Python environment with Prefect installed, pointed at either open-source Prefect or Prefect Cloud.</p>
<p>To run the example, you'll need a Python environment with Prefect installed, pointed at either an open-source Prefect server instance or Prefect Cloud.</p>
<p>With your environment set up, start a flow runner in one terminal with the following command:</p>
<div class="terminal">
<div class="highlight"><pre><span></span><code><span class="w"> </span>$<span class="w"> </span>python<span class="w"> </span>&lt;filename&gt;<span class="w"> </span>greeter
<div class="highlight"><pre><span></span><code>python<span class="w"> </span>my_file_name<span class="w"> </span>greeter
</code></pre></div>
</div>

<div class="codehilite"><pre><span></span><code>
</code></pre></div>

<p>For example, with Prefect Cloud, you should see output like this:</p>
<div class="terminal">
<div class="highlight"><pre><span></span><code>╭──────────────────────────────────────────────────────────────────────────────────────────────────╮
Expand All @@ -9754,13 +9751,13 @@ <h3 id="seeing-a-complete-example">Seeing a complete example<a class="headerlink
</code></pre></div>
</div>

<p>Then start the greeter in another process in another terminal:</p>
<p>Then start the greeter process in another terminal:</p>
<div class="terminal">
<div class="highlight"><pre><span></span><code><span class="w"> </span>$<span class="w"> </span>python<span class="w"> </span>&lt;filename&gt;<span class="w"> </span>sender
<div class="highlight"><pre><span></span><code>python<span class="w"> </span>my_file_name<span class="w"> </span>sender
</code></pre></div>
</div>

<p>You should see:</p>
<p>You should see output like this:</p>
<div class="terminal">
<div class="highlight"><pre><span></span><code><span class="m">11</span>:38:41.800<span class="w"> </span><span class="p">|</span><span class="w"> </span>INFO<span class="w"> </span><span class="p">|</span><span class="w"> </span>prefect.engine<span class="w"> </span>-<span class="w"> </span>Created<span class="w"> </span>flow<span class="w"> </span>run<span class="w"> </span><span class="s1">&#39;gregarious-owl&#39;</span><span class="w"> </span><span class="k">for</span><span class="w"> </span>flow<span class="w"> </span><span class="s1">&#39;sender&#39;</span>
<span class="m">11</span>:38:41.802<span class="w"> </span><span class="p">|</span><span class="w"> </span>INFO<span class="w"> </span><span class="p">|</span><span class="w"> </span>Flow<span class="w"> </span>run<span class="w"> </span><span class="s1">&#39;gregarious-owl&#39;</span><span class="w"> </span>-<span class="w"> </span>View<span class="w"> </span>at<span class="w"> </span>https://app.prefect.cloud/account/...
Expand Down
2 changes: 1 addition & 1 deletion versions/unreleased/search/search_index.json

Large diffs are not rendered by default.

Binary file modified versions/unreleased/sitemap.xml.gz
Binary file not shown.

0 comments on commit b889e65

Please sign in to comment.