search cancel

Migrating running C_PERIOD tasks from one system to another

book

Article ID: 229653

calendar_today

Updated On:

Products

CA Automic One Automation

Issue/Introduction

Is there a way to move C_PERIOD tasks that are running from one system to another or to promote executions from one environment to another?

Resolution

There is no built in way out of the box to accomplish this.  There are ways to keep C_PERIOD settings across environments via PERIOD objects, ways to automate the recurring executions of tasks; and using those two functions, there can then be ways to keep track of which PERIOD objects should be used for which tasks and then start these automatically from a script object.

Keeping C_PERIOD settings across environments.

We strongly suggest the use of PERIOD objects and starting recurring tasks using these instead of entering information manually every time you start a recurring task.  This will make it much easier to keep track of what you're starting and how to start it. As an example, if there is an object that should be run every 10 minutes on Monday, Wednesday, Friday, the Execute Recurring would normally look like this:

Using a PERIOD object with the same settings would look like this:

Automating recurring executions of tasks

The ACTIVATE_UC_OBJECT script function can be used to start tasks using the specific recurring properties from the PERIOD object using the syntax:
:set &ret# = activate_uc_object("[EXECUTABLE_OBJECT_NAME]",,,,"[PERIOD_OBJECT_NAME]")

For the example above where the object SCRI.EVERY_10_MIN-MWF should run using the recurring properties defined in the PERIOD.10.MIN-MWF PERIOD object, the script line would look like this:

:set &ret# = activate_uc_object("SCRI.EVERY_10_MIN-MWF",,,,"PERIOD.10.MIN-MWF")

Start multiple tasks with different PERIOD settings

Putting this all together, if you have a way to keep track of which objects get started with which PERIOD objects, something like the following could be put into place:

Keep the executable object and period object in a variable that has all of them you'd like to migrate, you could always use a script to loop through each row in the variable and then use the same activate_uc_object type script to start multiple at once:

Create a variable with the Key being the task/job name, value 1 being the timezone (where applicable), and value 2 being the PERIOD object name.  This might look something like:

Then create a main script that loops through the variable, grabs the key (task name), the timezone (value 1), and the period object name (value 2) and runs the activate_uc_object.  This may look something like this:

:set &hnd# = prep_process_var('vara.periodic_tasks')
:process &hnd#
:  set &key# = get_process_line(&hnd#, 1)
:  set &tz# = get_process_line(&hnd#, 2)
:  set &period# = get_process_line(&hnd#, 3)
:  set &ret# = activate_uc_object(&key#,,,&tz#,&period#)
:endprocess

That will loop through the variable and activate each task with the correct timezone and period object, activating a c_period object for that task.

Attachments