在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" 需要注意的是这 ...
随机推荐
- cms3.0——收获(1)
或许是由于各个公司的情况不同,使得每次写后台管理系统就沿用之前的nodejs中的thinkjs来写后台管理系统,也是因为这样后期维护起来更加方便吧?不过最早之前的项目,却有一个使用的是nodejs 中 ...
- 网站开发中必备的8个 jQuery 效果【附源码】
jQuery 作为最优秀 JavaScript 库之一,改变了很多人编写 JavaScript 的方式.它简化了 HTML 文档遍历,事件处理,动画和 Ajax 交互,而且有成千上万的成熟 jQuer ...
- Eclipse导出可执行Jar文件(包含第三方Jar包)
1. 首先,右键你的Java工程,选择Export,在Java文件夹下选择Runnable JAR file,如下图所示: 2. 选择Runnable JAR file后,会弹出如下所示的对话框,选择 ...
- Split的应用
public string qu(string ss) { string s1 = "" ; string[] s = ss.Split(); for (int i = 0; i ...
- POJ 1125 Stockbroker Grapevine 最短路 难度:0
http://poj.org/problem?id=1125 #include <iostream> #include <cstring> using namespace st ...
- 二模 (10)day1
第一题: 题目描述: 一个阅览室每天都要接待大批读者.阅览室开门时间是0,关门时间是T.每位读者的到达时间都不一样,并且想要阅读的刊物不超过5本.每位读者心里对自己想看的刊物都有一个排位,到达之后他会 ...
- dancing link 学习资源导航+心得
dancing link简直是求解数独的神器,NOIP2009最后一题靶形数独,DFS 各种改变搜索顺序 都没法过,最后还是用了卡时过得.用dancing link写,秒杀所有数据,总时间才400ms ...
- c#中使用servicestackredis操作redis
下载地址: https://github.com/mythz/ServiceStack.Redis 添加dll引用: using ServiceStack.Common.Extensions;usin ...
- virtualbox安装提示出现严重错误解决办法
解决办法: 在服务里面启动1. Device Install Service2. Device Setup Manager 这两个服务就好了.也有可能只需要启动第一个.
- 网易云课堂 OCP
数据库DBA任务: 管理数据库可用性 设计并创建数据库 管理物理结构 管理基于设计的存储 管理安全性 网络管理 备份与恢复 数据库调整与优化 关系型数据库(RDBMS) 多个表数据之间存在着关系 关系 ...