当前位置:网站首页>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
边栏推荐
- FLIR blackfly s industrial camera: synchronous shooting of multiple cameras through external trigger
- Cat recycling bin
- Zabbix 5.0:通过LLD方式自动化监控阿里云RDS
- CISP-PTE之命令注入篇
- 【Unity】升级版·Excel数据解析,自动创建对应C#类,自动创建ScriptableObject生成类,自动序列化Asset文件
- Flir Blackfly S 工业相机:自动曝光配置及代码
- Centros 8 installation MySQL Error: The gpg Keys listed for the "MySQL 8.0 Community Server" repository are already ins
- ROS learning (26) dynamic parameter configuration
- Date processing tool class dateutils (tool class 1)
- POJ 3177 redundant paths POJ 3352 road construction (dual connection)
猜你喜欢
PartyDAO如何在1年内把一篇推文变成了2亿美金的产品DAO
TiFlash 源码阅读(四)TiFlash DDL 模块设计及实现分析
Blackfly S USB3工业相机:缓冲区处理
张平安:加快云上数字创新,共建产业智慧生态
Shell script quickly counts the number of lines of project code
Ros Learning (23) Action Communication Mechanism
Mongodb checks whether the table is imported successfully
BigDecimal 的正确使用方式
刨析《C语言》【进阶】付费知识【一】
新一代云原生消息队列(一)
随机推荐
张平安:加快云上数字创新,共建产业智慧生态
处理streamlit库上传的图片文件
建議收藏!!Flutter狀態管理插件哪家强?請看島上碼農的排行榜!
Domestic images of various languages, software and systems. It is enough to collect this warehouse: Thanks mirror
ROS学习(二十)机器人SLAM功能包——rgbdslam的安装与测试
FLIR blackfly s industrial camera: configure multiple cameras for synchronous shooting
激光雷达:Ouster OS产品介绍及使用方法
CISP-PTE之命令注入篇
Errors made in the development of merging the quantity of data in the set according to attributes
Get to know MySQL for the first time
Freeswitch dials extension number source code tracking
freeswitch拨打分机号源代码跟踪
Stm32f4 --- general timer update interrupt
sql中批量删除数据---实体中的集合
[unique] what is the [chain storage structure]?
ROS learning (25) rviz plugin
ROS学习(十九)机器人SLAM功能包——cartographer
ROS学习(22)TF变换
ROS learning (26) dynamic parameter configuration
传感器:DS1302时钟芯片及驱动代码