How to limit number of workflow tokens

Each time vRealize Orchestrator (vRO) runs a workflow, a token (workflow execution) is added beneath the workflow in the vRO client. By default vRO will keep up to 100 of these tokens! This may be a slight annoyance to people who are only interested in the last 5-20 runs. This article will shed some light on the configuration options you have available to you.

Tired of seeing too many workflow tokens?

tired_of_seeing_too_many_workflow_tokens.png

Many developers prefer to have far fewer workflow tokens showing when they are working in the vRO client. Sure, you can right-click on the parent workflow and select Delete all finished workflow runs, but when you have scheduled tasks, policies, and users generating many tokens across many different workflows doing this manually can be tedious.

Maximum number of preserved runs per workflow

maximum_number_of_preserved_runs_per_workflow.png

As per the vRO 7.1 Documentation (click link for exact page), you can change the number of workflow tokens that are kept in the vRO client.

  • Let’s do that now! Return to your browser tab with your vRO Control Center page loaded and click on Advanced Options

vRO 7+ Configuration Settings

vro_7__configuration_settings.png

Configuration settings for vRO 7 and above are now managed using the vRO Control Center. This is a new interface that become available in a beta form with vRO 6 and fully replaced the old web configurator since vRO version 7.1. Version 7.0.1 still had a link back to the Legacy UI but that is now gone as well since all configurations are now done through the Control Center and/or vRO Workflows.

In order to access the Control Center, you must have the vco-configurator service running. It is not running by default when vRO is embedded in vRealize Automation (vRA.) How to access Control Center:

  • https://your-vro-server:8283/vco-controlcenter
  • https://your-vro-server:8281/vco - then click vRealize Orchestrator Control Center (login as root with your root pw for the appliance)
  • https://your-vra-server/vco - (Note: port 443 when vRO embedded in vRA) then click vRealize Orchestrator Control Center (login as root with your root pw for the appliance)

Change to 10

change_to_10.png
  • Set the value of Maximum number of preserved runs per workflow to the maximum number of workflow tokens you want shown under your workflows. For this article, we’ll set this to 10.
  • Click **Save **
  • Note the message that appears under the Saved successfully note - you need to restart the Orchestrator service in order to apply the changes. Click Startup Options to be taken to the page that allows you to restart the server service.

Restart the server service

restart_the_server_service_1.png

You may restart the Server service using Control Center by clicking Restart on this page.

**NOTE: ** the console/ssh equivalent of pushing this button is:

service vco-server restart

Workflow token purge

workflow_token_purge.png

After making the change above and restarting the vco-server service, you may notice that the changes may not appear to have taken effect right away. This may have to do with timing. A missing piece of documentation on that page linked above is the fact that the workflow tokens are purged once per hour by default. You can verify this by issuing the following command from an SSH session to your vRO server:

cat /var/log/vco/app-server/server.log | grep "Purging workflow tokens"

Note the timestamp at the beginning of the line - you’ll see the results indicate an hourly execution of the purge process!

But wait! I don’t want to wait an HOUR for the purge ! !

Okay, fine, let’s change that then!

System Properties

system_properties.png

Control Center provides an interface to add custom system properties to the vRO Server.

  • Click on System Properties

Add New Property

add_new_property.png
  • Add this text as the Key: com.vmware.o11n.purge.execution.cron
  • Specify this cron info for the Value: 0 0/5 * * * ?
  • Add the following as your Description: Purge workflow tokens every 5 minutes
  • Click Add

Wait a second… you’re probably wondering where I got that Key value from since it doesn’t appear to be in the documentation.

I actually found it in an older VMware Communities post after a colleague mentioned the key name in a Socialcast discsussion.

media_1475683744460.png

  • Note that your new property is now added (but not yet saved) to the server
  • Click Save changes to save these changes to a config file on the server (/var/lib/vco/app-server/conf/vmo-managed.properties)
  • As noted, you must now restart the server service in order to apply the new schedule
  • Click Home then click Startup Options(not shown)

Restart the Server service

restart_the_server_service.png

Click Restart

NOTE: Even though Current Status may indicate Running right away, the vco-server service actually takes a few minutes to really reach the Running state.

End result: 5 minute token purge

end_result_5_minute_token_purge.png
SSH to your vRO server and run the following command to verify the purge is now taking place every 5 minutes:

tail -f /var/log/vco/app-server/server.log | grep "Purging workflow tokens"

End Result

end_result.png
Once the configuration changes have been made and the purge cron job executes, no more than the specified number of workflow tokens will be present for all workflows. In this case, you can see that there are now only 10 workflow tokens for each of the test workflows shown in the screenshot!

Conclusion

As you can see in this short article, you do have the ability to control the number of workflow tokens per workflow. All it took was a couple configuration changes and a server restart to apply those changes.

I hope you found this article helpful!

If you have questions about vRO, please take advantage of the VMware Orchestrator Communities! This article even referenced an old thread there in order to get the Key value for a configuration setting.