Adding Checkpoint-workflow in a Runbook

Source: Internet
Author: User

This article describes a scenario where Checkpoint-workflow is used (and of course there are other scenarios that require Checkpoint-workflow).

causes: Windows Azure has a limit of 30minutes for runbooks running in the automation account.

mechanism: If your script does not run within 30minutes, then the worker who executes the script will tentative your script to handle the other account's tasks.

problem: When the next worker comes to execute your script, it starts with the last checkpoint. If you fail to set checkpoint during script execution and your script executes longer than 30minutes, your script will start from scratch every time.

This way, the endless execution continues until the system detects the situation and throws an exception to you.

The job cannot continue running because it is repeatedly evicted from the same checkpoint. Please make sure your runbooks does not perform lengthy operations without persisting their state.

Checkpoint Workflow

<Activity1>Checkpoint-workflow<activity2><error><activity3 >

Note that Checkpoint-workflow cannot be placed in InlineScript.

About Checkpoint, refer to 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 the This activity in a runbook, a checkpoint is immediately taken. If The Runbook is a suspended by a error, when the job is resumed, it'll 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 it output to The workflow. While commands in a workflow is sent to Windows workflow Foundation for processing, commands in an inlinescript block is Processed by Windows PowerShell. The activity uses the standard workflow common parameters including pscomputername and pscredential whic h allow you to specify that the code block is run on another computer or using alternate credentials.

While InlineScript activities is critical in certain runbooks, they should is used when necessary for th E following reasons:

    • You cannot use checkpoints from within a inlinescript block. If A failure occurs within the block, it must is resumed from the beginning.

    • InlineScript affects scalability of the runbook since it holds the Windows PowerShell session for the entire Leng Th of the InlineScript block.

    • Activities such as get-automationvariable and get-automationpscredential is not available on an Inline Script block.

You don't need to the use of an inlinescript, and you should minimize its scope. For example, if your runbooks iterates over a collection while applying the same operation to each item, the Loop should OC Cur outside of the InlineScript. This would provide the following advantages:

    • You can checkpoint the workflow through each iteration. If the job is suspended or interrupted and resumed, the loop would be a able to resume.

    • You can use the foreach–parallel to handle collection items concurrently.

Keep The following recommendations in mind if you do use a inlinescript in your runbook:

    • You can pass values into the script though with the $Using scope modifier. For example, a variable called $ABC that have been set outside of the InlineScript would become $using: ABC inside an in Linescript.

    • To return output from an inlinescript, assign the output to a variable and output any data to being returned to the Output stream. The following example assigns the string "HI" to a variable called $output.

      Copy
      $output = inlinescript {write-output "HI"}
    • Avoid defining workflows within inlinescript scope. Even though some workflows may appear to operate correctly, which is not a tested scenario. As a result, you may encounter confusing error messages or unexpected behavior.

Adding Checkpoint-workflow in a Runbook

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.