How to stop a running workflow
Running workflows can be stopped in several ways:
Programmable stop
You can stop running of workflow block by fx.stopAfterThisBlock function
Description of this function you can get by this link.
It is proposed for the case when a get block returns nothing and you do not want to run other blocks which do nothing. Using of this function saves AWS process resources and therefore your money.
var v = getVariables();
var src = await api.get('myst2/eventordersbystatus?status='+v['status']);
if (!src || !fx.any(src)) {
fx.stopAfterThisBlock(false); // false - stops workflow after current block and does not update dateLastRun
}
Result​
- The workflow and block are in Redy status
- Response and User Log are availabled
- Session objects are availabled
- DateLastRun is updated or not: it depence on input parameter for stopAfterThisBlock
- Session.vault and Session.vaultGlobal are moved or not into myVault: it depence on input parameter for stopAfterThisBlock
Stop by click button
You can stop workflow running on workflow edit page by click on workflow button.
Dialog popup will be proposed you with 2 options:
- safe stop
- stop immediately
Choose needed option and then click to Stop button
Safe stop​
The option is proposed for the case when you want to wait untill the currend block will be finished with processing and the workflow will be stopped then.
It is recomended option and set as default.
Result​
- The workflow and block are in SafeStop status at the beginning and moved to Stopped status then
- Response and User Log are availabled
- Session objects are availabled
- DateLastRun is not updated
- Session.vault and Session.vaultGlobal are not moved into myVault
Stop immediately​
The option is proposed for the case when you want to stop processing immediatly and do not wait untill it will be finished. There is a restriction that it can be stopped just in places which call any asyncronius code. It is not a Canvas restriction, it is a Node.js restriction with blocked operations. This description you can get by this link.
It is not recomended option because the bahaivour of integration result may be unpredicted. For example, if you post some data into target application and stopped running before saving in myVault. In this case duplicates can be created next time. Please use this option just in case if integration result are predicted.
Result​
- The workflow and block are in ImmediatlyStop status at the beginning and moved to Stopped status then
- Response and User Log are not availabled
- Session objects are not availabled
- DateLastRun is not updated
- Session.vault and Session.vaultGlobal are not moved into myVault
Auto stop
The workflow can be stopped automatically by Canvas block processor, if processor was restarted during processing. One of restarting reason can be a memory exception. If your block was moved to Stopped automatically please contact to CMA support team.
Result​
- The workflow and block are in AutoStop status
- Response and User Log are not availabled
- Session objects are not availabled
- DateLastRun is not updated
- Session.vault and Session.vaultGlobal are not moved into myVault
📋Related articles​
You can get the full list of block statuses by this link You can get Canvas vocabulary by this link