当前位置:网站首页>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
边栏推荐
- Personal thoughts on Architecture Design (this article will be revised and updated continuously later)
- 需求开发思考
- Write it down once Net analysis of thread burst height of an industrial control data acquisition platform
- 1007 Maximum Subsequence Sum(25 分)(PAT甲级)
- 西门子HMI下载时提示缺少面板映像解决方案
- Multi table operation inner join query
- Niuke Xiaobai monthly race 7 I new Microsoft Office Word document
- 如何使用Async-Awati异步任務處理代替BackgroundWorker?
- 1009 Product of Polynomials(25 分)(PAT甲级)
- 上线首月,这家露营地游客好评率高达99.9%!他是怎么做到的?
猜你喜欢
水晶光电:长安深蓝SL03的AR-HUD产品由公司供应
Comment utiliser async awati asynchrone Task Handling au lieu de backgroundworker?
公司要上监控,Zabbix 和 Prometheus 怎么选?这么选准没错!
English语法_名词 - 使用
【问题】druid报异常sql injection violation, part alway true condition not allow 解决方案
mysql中explain语句查询sql是否走索引,extra中的几种类型整理汇总
Some thoughts on whether the judgment point is located in the contour
Opencv functions and methods related to binary threshold processing are summarized for comparison and use
实战模拟│JWT 登录认证
Multi table operation - external connection query
随机推荐
JVM系列之对象的创建
Niuke Xiaobai monthly race 7 I new Microsoft Office Word document
c# . Net MVC uses Baidu ueditor rich text box to upload files (pictures, videos, etc.)
1007 Maximum Subsequence Sum(25 分)(PAT甲级)
1003 emergency (25 points) (PAT class a)
Niuke Xiaobai month race 7 who is the divine Archer
Dark horse programmer - software testing - 09 stage 2-linux and database -31-43 instructions issued by modifying the file permission letter, - find the link to modify the file, find the file command,
Oracle with as ora-00903: invalid table name multi report error
Kotlin condition control
C# 使用StopWatch测量程序运行时间
矩阵翻转(数组模拟)
Introduction to polyfit software
[QNX Hypervisor 2.2用户手册]6.3.1 工厂页和控制页
西门子HMI下载时提示缺少面板映像解决方案
【问题】druid报异常sql injection violation, part alway true condition not allow 解决方案
c# .net mvc 使用百度Ueditor富文本框上传文件(图片,视频等)
92.(cesium篇)cesium楼栋分层
English语法_名词 - 使用
1008 Elevator(20 分)(PAT甲级)
Detailed explanation of the binary processing function threshold() of opencv