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


边栏推荐
- 1003 Emergency(25 分)(PAT甲级)
- 西门子HMI下载时提示缺少面板映像解决方案
- 应用实践 | 蜀海供应链基于 Apache Doris 的数据中台建设
- kotlin 基本数据类型
- The explain statement in MySQL queries whether SQL is indexed, and several types in extra collate and summarize
- HDU 1372 & POJ 2243 Knight Moves(广度优先搜索)
- The page element is vertically and horizontally centered, realizing the vertical and horizontal centering of known or unknown width.
- How to use async Awati asynchronous task processing instead of backgroundworker?
- [QNX Hypervisor 2.2用户手册]6.3.1 工厂页和控制页
- 牛客小白月赛7 F题
猜你喜欢

mysql中explain语句查询sql是否走索引,extra中的几种类型整理汇总

Abc229 summary (connected component count of the longest continuous character graph in the interval)

BCG 使用之CBCGPProgressDlg进度条使用

Online text line fixed length fill tool

实战模拟│JWT 登录认证

Online sql to excel (xls/xlsx) tool

node_ Exporter deployment

Oracle with as ora-00903: invalid table name multi report error

The explain statement in MySQL queries whether SQL is indexed, and several types in extra collate and summarize

SSRS筛选器的IN运算(即包含于)用法
随机推荐
Dark horse programmer - software testing - stage 08 2-linux and database-23-30-process port related, modify file permissions, obtain port number information, program and process related operations, Li
1006 Sign In and Sign Out(25 分)(PAT甲级)
Mysql database basic operation -ddl | dark horse programmer
SSRS筛选器的IN运算(即包含于)用法
Online text line fixed length fill tool
Reflection (I)
水晶光电:长安深蓝SL03的AR-HUD产品由公司供应
多表操作-内连接查询
Kotlin basic data type
Several methods of online database migration
Crawler (6) - Web page data parsing (2) | the use of beautifulsoup4 in Crawlers
Hough transform Hough transform principle
. Net ORM framework hisql practice - Chapter 2 - using hisql to realize menu management (add, delete, modify and check)
Specify the character set to output
An example of multi module collaboration based on NCF
HMM隐马尔可夫模型最详细讲解与代码实现
How to use async Awati asynchronous task processing instead of backgroundworker?
[QNX hypervisor 2.2 user manual]6.3.1 factory page and control page
Oracle with as ora-00903: invalid table name multi report error
西门子HMI下载时提示缺少面板映像解决方案