|
1 | | -# 阿里云函数计算 Python 3.6 async task 案例 |
| 1 | +# 阿里云函数计算 Python3.6 Async Task 函数案例 |
2 | 2 |
|
3 | | -只需几步就可以快速在阿里云函数计算服务上体验 Python 3.6 的 async task: |
| 3 | +<toc> |
4 | 4 |
|
5 | | -- 初始化项目:`s init start-async-task-python3` |
| 5 | +<p align="center"><b> 中文 | <a href="./readme_en.md"> English </a> </b></p> |
| 6 | + |
| 7 | +- [快速开始](#快速开始) |
| 8 | + - [通过应用中心部署](#通过应用中心部署) |
| 9 | + - [通过命令行工具部署](#通过命令行工具部署) |
| 10 | + - [通过阿里云CloudShell部署](#通过阿里云CloudShell部署) |
| 11 | +- [应用详情](#应用详情) |
| 12 | +- [关于我们](#关于我们) |
| 13 | + |
| 14 | +</toc> |
| 15 | + |
| 16 | +# 快速开始 |
| 17 | + |
| 18 | +- [:octocat: 源代码](https://github.com/devsapp/start-fc/tree/master/async-task/python3/src) |
| 19 | + |
| 20 | +## 通过应用中心部署 |
| 21 | + |
| 22 | +<appcenter> |
| 23 | + |
| 24 | +您可以在阿里云 [:earth_asia: Serverless 应用中心](https://fcnext.console.aliyun.com/applications/create?template=start-async-task-python3) ,快速体验该应用: |
| 25 | + |
| 26 | +[](https://fcnext.console.aliyun.com/applications/create?template=start-async-task-python3) |
| 27 | + |
| 28 | +</appcenter> |
| 29 | + |
| 30 | +## 通过命令行工具部署 |
| 31 | + |
| 32 | +> 在开始之前,需要先安装 Serverless Devs 开发者工具:`npm install @serverless-devs/s -g`,更多安装方法,可以参考[Serverless Devs 安装文档](https://www.serverless-devs.com/serverless-devs/install) ,针对阿里云还需要配置密钥信息,配置密钥信息的方法可以参考[阿里云密钥配置文档](https://www.serverless-devs.com/fc/config) |
| 33 | +
|
| 34 | +- 初始化项目:`s init start-async-task-python3 -d start-async-task-python3` |
| 35 | + > 涉及到确定密钥的选择、服务名称的确定、函数名称的确定以及容器镜像的确定 |
6 | 36 | - 进入项目:`cd start-async-task-python3` |
7 | | -- 部署项目:`s deploy` |
8 | | -- 触发项目 |
9 | | - - 1. `s async-task invoke -e {} --invocation-type async`, 成功调用一次 task 函数, 预计 30s 后, 函数执行成功, 会触发调用dest-succ 函数一次 |
10 | | - - 2. `s async-task invoke -e {"mock_error":1} --invocation-type async`, 调用一次 task 函数, 预期让 task 函数执行失败一次,会触发调用 dest-fail 函数一次 |
11 | | - - 3. `s async-task invoke -e {} --invocation-type async`, 成功调用一次 task 函数, 在函数执行过程中,在控制台取消这次任务函数的执行, 会触发调用 dest-fail 函数一次 |
12 | | - |
13 | | -即可实现`Python 3.6` async task 案例的初始化、部署整个流程。 |
14 | | - |
15 | | -> 本应用仓库地址:https://github.com/devsapp/start-fc |
16 | | -
|
17 | | ------------------------------------- |
18 | | -> # More |
19 | | -> 欢迎您使用阿里云函数计算 FC 组件进行项目开发 |
20 | | -> 组件仓库地址/帮助文档:https://github.com/devsapp/fc |
21 | | -> Yaml参考文档:https://github.com/devsapp/fc/blob/main/docs/zh/yaml.md |
22 | | -> 快速入门: |
23 | | -> - 快速创建应用:https://github.com/devsapp/fc/blob/main/docs/zh/quick_start_application.md |
24 | | -> - 快速使用命令:https://github.com/devsapp/fc/blob/main/docs/zh/quick_start_function.md |
25 | | ------------------------------------- |
| 37 | +- 部署项目:`s deploy -y` |
| 38 | +- 调用函数: |
| 39 | + - 1. `s async-task invoke -e {} --invocation-type async`, 成功调用一次 task 函数, 预计 30s 后, 函数执行成功, 会触发调用dest-succ 函数一次 |
| 40 | + - 2. `s async-task invoke -e {"mock_error":1} --invocation-type async`, 调用一次 task 函数, 预期让 task 函数执行失败一次,会触发调用 dest-fail 函数一次 |
| 41 | + - 3. `s async-task invoke -e {} --invocation-type async`, 成功调用一次 task 函数, 在函数执行过程中,在控制台取消这次任务函数的执行, 会触发调用 dest-fail 函数一次 |
| 42 | + |
| 43 | + |
| 44 | +## 通过阿里云CloudShell部署 |
| 45 | + |
| 46 | +如果您不想在应用中心中快速体验,也不想下载命令行工具体验,您也可以在[ :rocket: 阿里云 CloudShell](https://api.aliyun.com/new#/tutorial?action=git_open&git_repo=https://github.com/devsapp/start-fc.git&tutorial=async-task/python3/cloudshell.md) 中快速体验。 |
| 47 | + |
| 48 | +# 应用详情 |
| 49 | + |
| 50 | +本应用仅作为学习和参考使用,您可以基于本项目进行二次开发和完善,实现自己的业务逻辑 |
| 51 | + |
| 52 | +# 关于我们 |
| 53 | + |
| 54 | +- Serverless Devs 工具: |
| 55 | + - 仓库:[https://www.github.com/serverless-devs/serverless-devs](https://www.github.com/serverless-devs/serverless-devs) |
| 56 | + > 欢迎帮我们增加一个 :star2: |
| 57 | + - 官网:[https://www.serverless-devs.com/](https://www.serverless-devs.com/) |
| 58 | +- 阿里云函数计算组件: |
| 59 | + - 仓库:[https://github.com/devsapp/fc](https://github.com/devsapp/fc) |
| 60 | + - 帮助文档:[https://www.serverless-devs.com/fc/readme](https://www.serverless-devs.com/fc/readme) |
| 61 | +- 钉钉交流群:33947367 |
0 commit comments