<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Dapr Python SDK 与 Dapr Workflow 扩展集成 on Dapr 文档库</title><link>https://v1-18.docs.dapr.io/zh-hans/developing-applications/sdks/python/python-sdk-extensions/python-workflow-ext/</link><description>Recent content in Dapr Python SDK 与 Dapr Workflow 扩展集成 on Dapr 文档库</description><generator>Hugo</generator><language>zh-hans</language><atom:link href="https://v1-18.docs.dapr.io/zh-hans/developing-applications/sdks/python/python-sdk-extensions/python-workflow-ext/index.xml" rel="self" type="application/rss+xml"/><item><title>使用 Dapr Workflow Python SDK 入门</title><link>https://v1-18.docs.dapr.io/zh-hans/developing-applications/sdks/python/python-sdk-extensions/python-workflow-ext/python-workflow/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/zh-hans/developing-applications/sdks/python/python-sdk-extensions/python-workflow-ext/python-workflow/</guid><description>&lt;div class="alert alert-primary" role="alert">
&lt;h4 class="alert-heading">注意&lt;/h4>

 Dapr Workflow 目前处于 alpha 阶段。

&lt;/div>

&lt;p>我们来创建一个 Dapr 工作流，并通过控制台调用它。通过&lt;a href="https://github.com/dapr/python-sdk/tree/master/examples/demo_workflow">提供的 hello world 工作流示例&lt;/a>，您将会：&lt;/p>
&lt;ul>
&lt;li>运行一个&lt;a href="https://github.com/dapr/python-sdk/blob/master/examples/demo_workflow/app.py">使用 &lt;code>DaprClient&lt;/code> 的 Python 控制台应用程序&lt;/a>&lt;/li>
&lt;li>利用 Python 工作流 SDK 和 API 调用来启动、暂停、恢复、终止和清除工作流实例&lt;/li>
&lt;/ul>
&lt;p>此示例使用 &lt;code>dapr init&lt;/code> 的默认配置在&lt;a href="https://github.com/dapr/cli#install-dapr-on-your-local-machine-self-hosted">本地模式&lt;/a>下运行。&lt;/p>
&lt;p>在 Python 示例项目中，&lt;code>app.py&lt;/code> 文件包含应用程序的设置，其中包括：&lt;/p>
&lt;ul>
&lt;li>工作流定义&lt;/li>
&lt;li>工作流活动定义&lt;/li>
&lt;li>工作流和工作流活动的注册&lt;/li>
&lt;/ul>
&lt;h2 id="先决条件">先决条件&lt;/h2>
&lt;ul>
&lt;li>已安装 &lt;a href="https://v1-18.docs.dapr.io/zh-hans/getting-started/install-dapr-cli/">Dapr CLI&lt;/a>&lt;/li>
&lt;li>已初始化 &lt;a href="https://v1-18.docs.dapr.io/zh-hans/getting-started/install-dapr-selfhost/">Dapr 环境&lt;/a>&lt;/li>
&lt;li>已安装 &lt;a href="https://www.python.org/downloads/">Python 3.8+&lt;/a>&lt;/li>
&lt;li>已安装 &lt;a href="https://v1-18.docs.dapr.io/zh-hans/developing-applications/sdks/python/#installation">Dapr Python 包&lt;/a> 和 &lt;a href="https://v1-18.docs.dapr.io/zh-hans/developing-applications/sdks/python/python-sdk-extensions/python-workflow-ext/python-workflow/">工作流扩展&lt;/a>&lt;/li>
&lt;li>确保您使用的是最新的 proto 绑定（proto 绑定是用于定义服务接口的协议缓冲区文件）&lt;/li>
&lt;/ul>
&lt;h2 id="设置环境">设置环境&lt;/h2>
&lt;p>运行以下命令以安装使用 Dapr Python SDK 运行此工作流示例的必要依赖。&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>pip3 install -r demo_workflow/requirements.txt
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>克隆 [Python SDK 仓库]。&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-bash" data-lang="bash">&lt;span style="display:flex;">&lt;span>git clone https://github.com/dapr/python-sdk.git
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>从 Python SDK 根目录导航到 Dapr 工作流示例。&lt;/p></description></item></channel></rss>