当前位置:网站首页>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
边栏推荐
- Modify the system time of Px4 flight control
- Ds-5/rvds4.0 variable initialization error
- MySQL execution process and sequence
- ROS学习(24)plugin插件
- Make DIY welding smoke extractor with lighting
- sql中批量删除数据---实体中的集合
- Vingt - trois mille feuilles? "Yang mou" derrière l'explosion de la consommation végétale
- Blackfly s usb3 industrial camera: buffer processing
- Flir Blackfly S 工业相机:自动曝光配置及代码
- 使用Ceres进行slam必须要弄清楚的几个类和函数
猜你喜欢
张平安:加快云上数字创新,共建产业智慧生态
Blackfly s usb3 industrial camera: buffer processing
猫猫回收站
Processing image files uploaded by streamlit Library
Analyze "C language" [advanced] paid knowledge [II]
SchedulX V1.4.0及SaaS版发布,免费体验降本增效高级功能!
String or binary data will be truncated
Vingt - trois mille feuilles? "Yang mou" derrière l'explosion de la consommation végétale
Box stretch and pull (left-right mode)
Make DIY welding smoke extractor with lighting
随机推荐
MetaForce原力元宇宙开发搭建丨佛萨奇2.0系统开发
ROS learning (26) dynamic parameter configuration
1500万员工轻松管理,云原生数据库GaussDB让HR办公更高效
Command injection of cisp-pte
Word wrap when flex exceeds width
String to date object
Centos8 install MySQL 8.0 using yum x
MySQL's most basic select statement
Flir Blackfly S USB3 工业相机:白平衡设置方法
Flir Blackfly S USB3 工业相机:计数器和定时器的使用方法
Input and output of C language pointer to two-dimensional array
centos8 用yum 安装MySQL 8.0.x
2022/0524/bookstrap
Yiwen takes you into [memory leak]
3D激光SLAM:Livox激光雷达硬件时间同步
大咖云集|NextArch基金会云开发Meetup来啦!
centos8安裝mysql報錯:The GPG keys listed for the “MySQL 8.0 Community Server“ repository are already ins
XML to map tool class xmlmaputils (tool class V)
ROS learning (22) TF transformation
Add PDF Title floating window