Reusing a workload in another environment

During the design of your workload it is possible to utilize workloads that have been used in other environments. For example, when necessary it is possible to import a workload application template in a different environment. Here you can find the instructions to create, export and import a workload application template.

Creating a workload application template

How to define a workload application template using the Dynamic Workload Console.

Before you begin

To ensure the workload automation solution can be easily reproduced in another environment, there are some best practices to consider when creating the workload application template:
Job definitions
Jobs that refer to elements that are dependent on the environment or topology in which they reside, such as web service jobs, file transfer jobs, and database jobs to name a few, should make use of variables when specifying these elements such as credentials, paths, and port numbers. Variables can be managed in the mapping file so that the correct values can be assigned to the variable.
Workstation names
When jobs and job streams are extracted from the workload application during the export process, the names of the workstations are extracted as they are found in the source environment. Meaningful names or a standardized naming convention can simplify the mapping process.
Users
Users are also extracted as they are found in the source environment. If the same user is not present in both source and target environment, then variables should be used to specify the user.
Mapping file
The mapping file should be maintained after performing the import process. It can be useful in the case where you want to replace a workload application or update it making the necessary changes to the mapping file.
Job stream variable table
All of the variables used to generically represent objects in the workload application should be added to a specific variable table related to the job stream in the workload application. This enables the customization of the job stream to reflect the target environment through the mapping file. Avoid associating the default variable table to a job stream. The default variable table is extracted like any other table and will need to be renamed, otherwise, the import process fails because a table with the same name already exists. The target environment already has a default variable table, MAIN_TABLE, defined.
Run cycle variable table
All of the variables used to generically represent objects in the workload application should be added to a specific variable table related to the run cycle in the workload application. This enables the customization of the run cycle to reflect the target environment through the mapping file. Avoid associating the default variable table to a run cycle. The default variable table is extracted like any other table and will need to be renamed, otherwise, the import process fails because a table with the same name already exists. The target environment already has a default variable table, MAIN_TABLE, defined.
Folders
The folders imported from a workload application template must be already mapped in the existing environment. Therefore before importing a workload application template from another environment, the folders contained in the template must be created before the process of import.

Storing scheduling objects in folders is supported starting from version 9.5 and later. When importing a workload application from a product version earlier than 9.5, all imported objects are stored in the root folder. Ensure you have write access to the root folder before starting the import.

About this task

From the Workload Designer, you can create the template of a workload that can then be imported and run in another environment. You can create a workload application template containing one or more job streams with all the related jobs and internal or external dependencies (such as files, resources, prompts) so as to have a self-contained workflow. You can then export the workload application template to deploy and run it in another environment. Select the objects you do not want to import. If you choose to skip an object, an object with the same name must be present in the target environment, otherwise an error message is returned.To create a workload application template, perform the following procedure:

Procedure

  1. From the navigation toolbar, click Design > Workload Definitions > Manage Workload Definitions
  2. Specify the name of a distributed engine.
    The Workload Designer opens.
  3. From the Create New pane, select Workload Application Template.
    The workload application template is created in the Details view and its properties page is displayed.
  4. In the properties pane, specify the attributes for the workload application template that you are creating:
    Name
    Mandatory field that contains the name of the workload application template. The maximum length is 80 characters.
    Description
    Optional descriptive text to help workload application users understand the purpose and characteristics of the workload application. The maximum length is 120 characters.
    Provider
    Optional field that specifies the creator of the workload application template. It can be useful to let workload application users know who created and provided it. The maximum length is 120 characters.
  5. From the Details view, right-click the workload application template and click Add Job Stream to add job streams to it.
  6. From the lookup dialog, search for and select the job streams that you want to add.
    Together with the job streams, the corresponding dependencies are automatically also added to the workload application template.
  7. Click Save to save the workload application template in the database.
  8. Right-click the workload application template and click Export to produce a compressed file, named workload application template name.zip, containing all the files and information required to allow the workload to run also in another environment.

Results

The compressed file contains:
workload application template name_Definitions.UTF8.xml
XML file that contains the definitions of all the exported objects. These definitions will be deployed in the target environment to populate the target database with the same objects existing in the source environment. The objects in the definition file can remain as they are or you can choose to rename them. If an object does not have a definition in the definition file, for example, a workstation, then at import time, a corresponding object will not be created in the target environment. The expectation is that such object is already present in the target environment, therefore, for these types of objects, you must map them in the mapping file.
workload application template name_Mapping.UTF8.properties
Mapping file that is used to replace the names of the objects in the source environment with the names that these objects have in the target environment. The objects that will be created in the target environment can be created with the same names as those in the source environment or you can specify a different name in this file.
When the import process is performed from the wappman command line, you can optionally request that the mapping file is automatically modified according to rules defined using regular expressions and specified in one of the following ad-hoc files:
  • workload application template name_BasicRegExpMapping.UTF8.rules
  • workload application template name_AdvancedRegExpMapping.UTF8.rules
These files are produced by the export process and, if used, must be properly customized.
workload application template name_SourceEnv_reference.txt
Reference information containing the definitions of the workstations used in the workload application template and other information that can be useful to correctly map the source environment into the target environment so as to allow the workload application to run.
workload application template name_BasicRegExpMapping.UTF8.rules
A file containing rules, defined using basic regular expressions, to modify the mapping file. Optionally customize the file according to the names that the objects will have in the target environment. The import process performed from the wappman command line then applies the defined rules to modify the mapping file.
workload application template name_AdvancedRegExpMapping.UTF8.rules
A file containing rules, defined using advanced regular expressions, to modify the mapping file. Optionally customize the file according to the names that the objects will have in the target environment. The import process performed from the wappman command line then applies the defined rules to modify the mapping file.

You can import the compressed package from the Dynamic Workload Console with an intuitive guided procedure, as described in Importing a workload application template.

You can also use the wappman command line to manually import the compressed package into the target environment where the workload application will be deployed, thus creating all the required objects in the target environment. In the target environment, the workload application name_Mapping.UTF8.properties file must be modified, manually or using regular expression mapping files, by specifying the names of the objects as they are defined in the target environment (for example, the names of the workstations on which the job streams run). If importing the workload application template from the Dynamic Workload Console, the user interface provides the possibility to specify the names of the objects in the target environment.

Exporting a job stream definition as a workload application template

Before you begin

To perform this task, ensure the HCL Workload Automation engine connection is up and running.

About this task

To export a job stream definition as a workload application template, run the following procedure from the Workload Designer :

Procedure

  1. Open the job stream whose definition that you want to export. To find the job stream, do either of the following actions:
    • Search for it using the Search menu in the Working List
    • Select the job stream icon Job stream icon and launch a search.
  2. You can now export the job stream by using either the Details or the Graphical view. Select the tab for the view you want.
    • From the Details view or the Graphical view, by using the menus, do the following:
      1. Right-click the job stream and select the Download Job Stream Definition option from the context menu or select the job stream and choose the same option from the Select an Action menu.
      2. A system panel is displayed for you to specify the download location.

Results

The job stream definition is exported as a workload application template, in a compressed file. The compressed file is named, by default, job_stream_name.zip. You can now import the job stream definition in a different environment.

Importing a workload application template

How to import a workload application template using the Dynamic Workload Console.

Before you begin

Ensure you have created a workload application template as described in Creating a workload application template.

About this task

You can import a workload application template that represents an efficient workload process or a standardized solution into a target environment to replicate all of the required objects to run the workload in the new environment.

You can also decide whether or not to maintain a tie to the workload application which binds the objects to the workload application, or to import the objects eliminating any ties to the workload application. Eliminating ties to the workload application allows you to manage objects with more flexibility.

Note: Before you import a workload application containing folders into an environment with a product version earlier than 9.5, ensure you remove every occurrence of the FOLDER_/=/ string from the xml file.
To import a workload application template, perform the following procedure:

Procedure

  1. From the navigation toolbar, click Administration > Workload Definitions > Import Workload Application
  2. Specify the name of a distributed engine
  3. Browse to the workload application template.
  4. Click Upload.
    If the administrator has enabled the justification option in the Auditing Preferences page to maintain an audit trail, a panel is displayed requesting information about the changes you are about to perform.
  5. In the section Import Options, select Import only the contents of the workload application template, if you want to import only the objects contained in the template, without any ties to the workload application. This allows you to work freely with the objects contained in the template. (This import is supported only when connected to an engine with version 9.4.0.4 or later)
  6. You now need to edit the names of the objects as they are defined in the target environment (for example, the names of the workstations on which the job streams run). In the left column, under the Original Workload heading, you can find the original objects, such as workstations, jobs, and job streams. In the fields in the right column, you can enter the names to be assigned to the objects in the target environment.
  7. Click Import.

Results

The workload application template is now imported and ready for use in your target environment.