当前位置:网站首页>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-07 02:14: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
边栏推荐
- Get to know MySQL for the first time
- 处理streamlit库上传的图片文件
- JS how to quickly create an array with length n
- centos8安装mysql报错:The GPG keys listed for the “MySQL 8.0 Community Server“ repository are already ins
- Flir Blackfly S 工业相机:配置多个摄像头进行同步拍摄
- 解密函数计算异步任务能力之「任务的状态及生命周期管理」
- LeetCode. Sword finger offer 62 The last remaining number in the circle
- Cisp-pte practice explanation (II)
- ROS學習(23)action通信機制
- JVM memory model
猜你喜欢

ROS learning (XX) robot slam function package -- installation and testing of rgbdslam

Blackfly s usb3 industrial camera: buffer processing

2022/0524/bookstrap

CISP-PTE实操练习讲解(二)

组合导航:中海达iNAV2产品描述及接口描述

Errors made in the development of merging the quantity of data in the set according to attributes

红外相机:巨哥红外MAG32产品介绍

How can I code for 8 hours without getting tired.

Flir Blackfly S 工业相机:配置多个摄像头进行同步拍摄

【Unity】升级版·Excel数据解析,自动创建对应C#类,自动创建ScriptableObject生成类,自动序列化Asset文件
随机推荐
传感器:DS1302时钟芯片及驱动代码
JVM memory model
Input and output of C language pointer to two-dimensional array
Vingt - trois mille feuilles? "Yang mou" derrière l'explosion de la consommation végétale
ROS学习(23)action通信机制
First experience of JSON learning - the third-party jar package realizes bean, list and map to create JSON format
LeetCode. Sword finger offer 62 The last remaining number in the circle
Treadpoolconfig thread pool configuration in real projects
ROS learning (23) action communication mechanism
ROS learning (26) dynamic parameter configuration
【服务器数据恢复】raid损坏导致戴尔某型号服务器崩溃的数据恢复案例
BigDecimal 的正确使用方式
Zabbix 5.0:通过LLD方式自动化监控阿里云RDS
Flir Blackfly S 工业相机 介绍
开发中对集合里面的数据根据属性进行合并数量时犯的错误
ROS learning (XX) robot slam function package -- installation and testing of rgbdslam
The GPG keys listed for the "MySQL 8.0 community server" repository are already ins
建议收藏!!Flutter状态管理插件哪家强?请看岛上码农的排行榜!
大咖云集|NextArch基金会云开发Meetup来啦!
处理streamlit库上传的图片文件