在Runbook中添加Checkpoint-workflow
本文说明的是使用Checkpoint-workflow的一种场景(当然还有其他场景需要Checkpoint-workflow)。
起因:Windows Azure对Automation账户中的Runbook运行时长限制了30minutes。
机制:就是如果你的脚本在30minutes内没有运行完成, 那么执行脚本的Worker会暂定你的脚本,去处理其他账户的任务。
问题:当下一个Worker再来执行您的脚本时,是从最近一次的Checkpoint开始的。如果你未能在脚本执行过程中设置Checkpoint而你的脚本执行时长又大于30minutes,那边你的脚本每次都会从头开始。
这样,永无止境的执行下去,直到系统检测到这种情况并给你抛出异常。
The job cannot continue running because it was repeatedly evicted from the same checkpoint. Please make sure your Runbook does not perform lengthy operations without persisting its state.
Checkpoint Workflow
<Activity1>
Checkpoint-Workflow
<Activity2>
<Error>
<Activity3>
注意的是Checkpoint-Workflow不能放在Inlinescript当中。
关于Checkpoint,参考 http://azure.microsoft.com/en-us/blog/azure-automation-reliable-fault-tolerant-runbook-execution-using-checkpoints/
some good points about checkpoint-workflow from Runbook concepts(https://technet.microsoft.com/en-us/library/Dn469257.aspx)
You can set a checkpoint in a workflow with the Checkpoint-Workflow activity. When you include this activity in a runbook, a checkpoint is immediately taken. If the runbook is suspended by an error, when the job is resumed, it will resume from the point of the last checkpoint set.
Some good points about InlineScript
The InlineScript activity runs a block of commands in a separate, non-workflow session and returns its output to the workflow. While commands in a workflow are sent to Windows Workflow Foundation for processing, commands in an InlineScript block are processed by Windows PowerShell. The activity uses the standard workflow common parameters including PSComputerName and PSCredential which allow you to specify that the code block be run on another computer or using alternate credentials.
While InlineScript activities may be critical in certain runbooks, they should only be used when necessary for the following reasons:
You cannot use checkpoints from within an InlineScript block. If a failure occurs within the block, it must be resumed from the beginning.
InlineScript affects scalability of the runbook since it holds the Windows PowerShell session for the entire length of the InlineScript block.
Activities such as Get-AutomationVariable and Get-AutomationPSCredential are not available in an InlineScript block.
you do need to use an InlineScript, you should minimize its scope. For example, if your runbook iterates over a collection while applying the same operation to each item, the loop should occur outside of the InlineScript. This will provide the following advantages:
You can checkpoint the workflow after each iteration. If the job is suspended or interrupted and resumed, the loop will be able to resume.
You can use ForEach –Parallel to handle collection items concurrently.
Keep the following recommendations in mind if you do use an InlineScript in your runbook:
You can pass values into the script though with the $Using scope modifier. For example, a variable called $abc that has been set outside of the InlineScript would become $using:abc inside an InlineScript.
To return output from an InlineScript, assign the output to a variable and output any data to be returned to the output stream. The following example assigns the string “hi” to a variable called $output.
$output = InlineScript { Write-Output "hi" }Avoid defining workflows within InlineScript scope. Even though some workflows may appear to operate correctly, this is not a tested scenario. As a result, you may encounter confusing error messages or unexpected behavior.
在Runbook中添加Checkpoint-workflow的更多相关文章
- odoo 在原有工作流中添加审批流
odoo 在原有工作流中添加审批流 步骤: 1.加入所需的工作流节点以及相连的线(即所添加的审批流),代码如下: <?xml version="1.0" encoding=& ...
- 在jekyll模板博客中添加网易云模块
最近使用GitHub Pages + Jekyll 搭建了个人博客,作为一名重度音乐患者,博客里面可以不配图,但是不能不配音乐啊. 遂在博客里面引入了网易云模块,这里要感谢网易云的分享机制,对开发者非 ...
- 在Linux(Luna)下向Launch启动器中添加图标
记录下在Luna下向Launch中添加图标的步骤,以供以后参考,这里我以加入eclipse图标为例: 首先,我们来创建一个desktop文件(Luna中到启动器Launch可以看作是Ubuntu中到桌 ...
- 用Retrofit发送请求中添加身份验证
用Retrofit发送请求中添加身份验证====================在安卓应用开发中, retrofit可以极大的方便发送http网络请求,不管是GET, POST, 还是PUT, DEL ...
- 在html中添加script脚本的方法和注意事项
在html中添加script脚本有两种方法,直接将javascript代码添加到html中与添加外部js文件,这两种方法都比较常用,大家可以根据自己需要自由选择 在html中添加<script& ...
- MVC学习随笔----如何在页面中添加JS和CSS文件
http://blog.csdn.net/xxjoy_777/article/details/39050011 1.如何在页面中添加Js和CSS文件. 我们只需要在模板页中添加JS和CSS文件,然后子 ...
- 怎样在Windows资源管理器中添加右键菜单以及修改右键菜单顺序
有时,我们需要在Windows资源管理器的右键菜单中添加一些项,以方便使用某些功能或程序. 比如我的电脑上有一个免安装版的Notepad++,我想在所有文件的右键菜单中添加一项用Notepad++打开 ...
- 在WebStorm环境中给nodejs项目中添加packages
照前文 http://www.cnblogs.com/wtang/articles/4133820.html 给电脑设置了WebStorm的IDE的nodejs开发环境.新建了个express的网站 ...
- dotnet webapi 中添加Swagger文档
首先添加"SwaggerGenerator": "1.1.0","SwaggerUi": "1.1.0" 需要注意的是这 ...
随机推荐
- 实验五 cmp传输与加解密
---恢复内容开始--- (一)实验内容 1.运行TCP代码,一人服务器,一人客户端 2.下载加解密代码,先编译运行代码,一人加密一人解密. 3.集成代码,一人加密后通过TCP 发送,加密使用DES或 ...
- 二模 (3) day1
第一题: 题目描述: 一个数列定义如下:f(1) = 1,f(2) = 1,f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.给定 A,B 和 n 的值,要求计算 ...
- [转载]Matrix类的使用
2013-12-18 11:31:00 转载自: http://www.cnblogs.com/mmy0925/archive/2013/01/22/2871009.html 在Android中,对图 ...
- bzoj 2301 莫比乌斯反演
对于给出的n个询问,每次求有多少个数对(x,y),满足a≤x≤b,c≤y≤d,且gcd(x,y) = k,gcd(x,y)函数为x和y的最大公约数. 这里题目意思很明显 对于要求的f[n] = sig ...
- https需要的类
import java.io.IOException; import java.net.InetAddress; import java.net.InetSocketAddress; import j ...
- CCNA 6.3
no encapsulation ppp(默认是encapsulation hdlc 在encapsulation ppp 后想要改回 hdlc 除了可用encapsulation hdlc外,还可以 ...
- monkey(1)
写完应用之后,作完单元测试和功能测试,必要对应用的抗打击能力做个测试,最好的方法是雇个“猴子”在测试,猴子可以胡乱瞎按键,在这种情况下,你的应用是否还能正常工作呢?Android 测试包中提供了一个M ...
- T-sql语句
在用代码编辑数据库时,首先要启动WAMPSERVER 1.创建表 create table Car ( Code varchar(50) primary key , Name varchar(50) ...
- ACM2013.9.7
acm还是要好好做的,还有好多的东西要学呢!不能不认真对待了,该玩够了!
- Gradle: The New Android Build System
Gradle: The New Android Build System Google selected Gradle as the foundation of the Android SDK bui ...