当前位置:网站首页>Decryption function calculates "task state and lifecycle management" of asynchronous task capability
Decryption function calculates "task state and lifecycle management" of asynchronous task capability
2022-07-04 19:53:00 【InfoQ】
Preface
Management of task status and life cycle
Task status management


- After the user triggers a task , Task in the team , Changed to: Enqueued state , And return trigger success ;
- The task is queued in the back-end service of function calculation , The task becomes Dequeued state ;
- The backend will check the task configuration . If
- The asynchronous message validity function is configured , And the difference between the time of leaving the team and the time of joining the team has exceeded the validity period , Then the task is discarded , Changed to: Expired state . Task to terminate ;
- The function corresponding to the task has been deleted , Or there is an error creating the instance , Then discard the message , The task is changed to Invalid state ;
- After the inspection, the task officially enters Running state . At this time, the task has triggered the actual execution ;
- When the task is completed , According to the return, it will change to the following states :
- Retrying: The user has configured the number of retries ( The default is 3), And the task execution failed , At this time, it will enter the retry state , Then it will be changed to Running state ;
- Failed: Task execution failed , And the number of retries has exceeded . The task status will be changed to Failed;
- Succeeded: The task was executed successfully .
- If the user triggers during the whole state flow Cancel, Then the task will be changed to Stopping state , And try to stop the task . When the task stops successfully , Mission entry Stopped state .
Task runtime management and life cycle

- The creation is complete -> Execute request phase : Support Initializer function , Support initializing instance operations . Users can configure such as global variables 、 Connection pool initialization and other related operations ;
- In execution -> After execution Pause example : Support PreFreeze Interface , Support in function Pause Execute user-defined logic before the instance ;
- In execution -> external cancel: Function evaluation will force Restart User instance , stay Restart Pre support PreStop Interface . The user can configure the logic of graceful stop , To support Cancel Custom behavior when ;
- After completion Pause -> Destroy instance : When there is no request for a period of time , Function calculation will destroy the instance . This will call PreStop Interface , Users can configure the behavior of destroying containers ( Such as closing the connection pool ).

Stop the task
import fc "github.com/aliyun/fc-go-sdk"
func CancelJob() {
stopInput := fc.NewStopStatefulAsyncInvocationInput("ServiceName", "FunctionName", "TaskUUID")
output, err := fcClient.StopStatefulAsyncInvocation(stopInput)
...
}
summary


边栏推荐
- HDU 1372 & POJ 2243 Knight moves (breadth first search)
- Educational Codeforces Round 22 E. Army Creation
- 牛客小白月赛7 F题
- 1006 sign in and sign out (25 points) (PAT class a)
- Multi table operation - external connection query
- Functional interface
- 明明的随机数
- 勾股数规律(任意三个数能够满足勾股定理需要满足的条件)
- 如何使用Async-Awati异步任务处理代替BackgroundWorker?
- 黑马程序员-软件测试--07阶段2-linux和数据库-09-24-linux命令学习步骤,通配符,绝对路径,相对路径,文件和目录常用命令,文件内容相关操作,查看日志文件,ping命令使用,
猜你喜欢

Pointnet/Pointnet++点云数据集处理并训练

YOLOv5s-ShuffleNetV2

Online sql to excel (xls/xlsx) tool

BCG 使用之CBCGPTabWnd控件(相当于MFC TabControl)

English grammar_ Noun - use

黑马程序员-软件测试--09阶段2-linux和数据库-31-43修改文件权限字母发的说明,-查找链接修改文件,查找文件命令,链接文件,压缩解压方式,vi编辑器基本使用,

92. (cesium chapter) cesium building layering

SSRS筛选器的IN运算(即包含于)用法
Niuke Xiaobai month race 7 who is the divine Archer

Stream stream
随机推荐
TCP两次挥手,你见过吗?那四次握手呢?
黑马程序员-软件测试--07阶段2-linux和数据库-09-24-linux命令学习步骤,通配符,绝对路径,相对路径,文件和目录常用命令,文件内容相关操作,查看日志文件,ping命令使用,
Explicit random number
求2的n次方
1005 Spell It Right(20 分)(PAT甲级)
Oracle with as ora-00903: invalid table name multi report error
1011 World Cup Betting (20 分)(PAT甲级)
【毕业季】绿蚁新醅酒,红泥小火炉。晚来天欲雪,能饮一杯无?
Niuke Xiaobai month race 7 who is the divine Archer
1011 World Cup betting (20 points) (pat a)
更强的 JsonPath 兼容性及性能测试之2022版(Snack3,Fastjson2,jayway.jsonpath)
牛客小白月赛7 F题
实战模拟│JWT 登录认证
Matrix flip (array simulation)
Jetpack Compose 教程
1002. A+B for Polynomials (25)(PAT甲级)
1007 Maximum Subsequence Sum(25 分)(PAT甲级)
[graduation season] green ant new fermented grains wine, red mud small stove. If it snows late, can you drink a cup?
kotlin 继承
公司要上监控,Zabbix 和 Prometheus 怎么选?这么选准没错!