当前位置:网站首页>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


边栏推荐
- @Data source connection pool exhaustion caused by transactional abuse
- 数据集划分
- kotlin 类和对象
- Pytorch学习(四)
- BCG 使用之CBCGPProgressDlgCtrl进度条使用
- 牛客小白月赛7 E Applese的超能力
- Jetpack compose tutorial
- Pointnet/Pointnet++点云数据集处理并训练
- Upgrade the smart switch, how much is the difference between the "zero fire version" and "single fire" wiring methods?
- . Net ORM framework hisql practice - Chapter 2 - using hisql to realize menu management (add, delete, modify and check)
猜你喜欢
Several methods of online database migration
多表操作-外连接查询
Pythagorean number law (any three numbers can meet the conditions of Pythagorean theorem)
C # use stopwatch to measure the running time of the program
多表操作-内连接查询
上线首月,这家露营地游客好评率高达99.9%!他是怎么做到的?
牛客小白月赛7 谁是神箭手
Lenovo explains in detail the green smart city digital twin platform for the first time to solve the difficulties of urban dual carbon upgrading
实战模拟│JWT 登录认证
The company needs to be monitored. How do ZABBIX and Prometheus choose? That's the right choice!
随机推荐
Siemens HMI download prompts lack of panel image solution
Kotlin condition control
HDU 6440 2018中国大学生程序设计网络选拔赛
92. (cesium chapter) cesium building layering
勾股数规律(任意三个数能够满足勾股定理需要满足的条件)
SSRS筛选器的IN运算(即包含于)用法
1008 elevator (20 points) (PAT class a)
1007 Maximum Subsequence Sum(25 分)(PAT甲级)
Educational Codeforces Round 22 E. Army Creation
公司要上监控,Zabbix 和 Prometheus 怎么选?这么选准没错!
1007 maximum subsequence sum (25 points) (PAT class a)
c# .net mvc 使用百度Ueditor富文本框上传文件(图片,视频等)
Actual combat simulation │ JWT login authentication
Opencv functions and methods related to binary threshold processing are summarized for comparison and use
2022 version of stronger jsonpath compatibility and performance test (snack3, fastjson2, jayway.jsonpath)
Pointnet/Pointnet++点云数据集处理并训练
BCG 使用之新建向导效果
1003 Emergency(25 分)(PAT甲级)
Find the nth power of 2
Educational codeforces round 22 E. Army Creation