View Jobs

Job manager

A job manager is a background job management tool that

  • enables you to schedule tools and initializers to run as background jobs, also known as asynchronous jobs, and

  • offers options to execute jobs using CLI and custom scripts.

The asynchronous jobs execute in the background on design engine instances configured during deployment.

The Job manager provides these options for background jobs:

  • Set a priority before submission

  • Schedule jobs to run at a required time

  • Cancel jobs before they move to the Running state

User role permissions for job manager

This topic describes the permissions assigned to different user roles in the Job Manager page.
  • Any user can view the jobs submitted by any other user.

  • Any user can view the results of the jobs submitted by any other user.

  • Any user can cancel (abort) the jobs submitted only by themselves.

  • Only admin users can cancel (abort) the jobs submitted by any user.

Access output plan files from job manager

Access output plan files from Job Manager to retrieve or download files generated by background jobs. This is useful for reviewing results, importing plan files into your user space, or downloading files for local analysis.

Use this task when you need to view, download, or import output plan files generated by jobs in the Job Manager.

Procedure


Step 1

From the main menu, choose Job Manager.

The Job Manager page opens and displays all background jobs.

Step 2

Click the .tar file in the Output file column to access the generated output files. To view the contents of a specific file, click on its file name.

If the file is in a human-readable format, its contents display correctly. For file types such as a .pln file, which are not human-readable, the contents may appear as garbled text. In such cases, download the file and open it with an appropriate application to view its contents properly.

Step 3

To import the output plan file into your user space:

  1. Click the name of the output file.

    The Extracted result page opens and displays all output files and logs.

  2. Locate the output plan file and click > Export to userspace.

The plan file is imported into your user space and becomes available for visualization.

Step 4

To download the file to your local machine:

  1. Click the name of the output file.

    The Extracted result page opens and displays all output files and logs.

  2. Locate the required file and click > Download.

The selected file is downloaded to your local machine.

Step 5

To download the complete output results, click > Download output file under the Actions column.

The tar file is downloaded to your local machine. Extract the file and import the required plan file into your user space. For details, see Import plan files from the local machine.

After completing these steps, you can access, download, or import output plan files from Job Manager. The files are available for review, visualization, or further processing as needed.

Run tools or initializers using CLI

In addition to running the tools and initializers from the Network Design page, Cisco Crosswork Planning supports running them using CLI.

Complete these steps to run the tools or initializers using CLI:

Procedure


Step 1

From the main menu, choose Job Manager.

The Job Manager page opens, displaying the list of all jobs submitted as background jobs.

Step 2

Click Add icon > Using CLI.

A list of all available tools and initializers appears.

Step 3

Select the required tool or initializer and click Next.

A list of all available plan files appears.

Step 4

Select the plan file in which you want to run the tool or initializer, and click Next.

The number of plan files you can select varies based on the tool or initializer chosen in the previous step. An error message appears at the top when the allowed number is exceeded.

Step 5

Enter the input configuration options in the text field, and click Next.

For help with this, click Usage Help. The Usage Help page displays the details of the configuration parameters that you can use in a specific tool or initializer. It also displays syntax, required configuration options, optional configuration options, and an example command.

Note

 
You can enter only the Optional options. You need not enter the tool name and the Required options.

On this page, you can also update the tool or initializer, and name of the output file.

  • To change the tool or initializer, click Edit next to the tool name that you already selected.

  • To update the name of the output file, enter the new name in the Output file field. By default, tool_out.txt is used as the file name.

Step 6

On the Run Settings page, choose whether to execute the task immediately or schedule it for a later time. Choose from these Execute options:

  • Now: Choose this option to run the tool/initializer immediately using the selected engine profile.

  • As a scheduled job: Choose this option to execute the task as an asynchronous job. The tool runs at the scheduled time and using the selected engine profile.

Based on the selection, set these options:

  • Priority: Select the priority of the task.

  • Engine profiles: Select the engine profile as needed. This section lists all the available asynchronous engine profiles.

  • Schedule: Set the time at which you want to run the tool. This option is available only for scheduled jobs.

Step 7

Track the status of the job on the Job Manager page. The job name is prefixed with "Cli:" in the Job column. Once the job completes, import the output plan file into user space to visualize it. For more information, refer to Access output plan files from job manager.


The tool or initializer runs as configured, and the output plan file is available for import and visualization in user space.

Run external scripts

In Cisco Crosswork Planning, OPM Python library (previously known as OPM API) and Design RPC Python libraries (previously known as Design RPC APIs) are supported via scripts. You can upload customized scripts that are created using these APIs. You can also use the scripts to run the CLI tools.

OPM Python libraries provide a powerful Python API to manipulate network models. It lets you operate on the network without having to worry about device-specific properties. Even if the underlying routers are replaced by routers from a different vendor, the API calls remain exactly the same.

For a sample Python script, refer to Example: Run external scripts.

Complete these steps to run the external scripts.

Procedure


Step 1

From the main menu, choose Job Manager.

The Job Manager page opens, displaying the list of all jobs submitted as background jobs.

Step 2

Click Add icon > Using script.

A list of scripts available in the user space appears.

Step 3

Select the required script and click Next to continue.

If the required script is not available in the list, use the Upload script option to upload the script. The script name appears under Available Scripts. You can also find the script file under the Network Models > My user space > All files section.

Step 4

Select the network models on which you want to run the script, and click Next.

Step 5

Enter the input configuration options in the text field using the following format, and click Next.

script_name arg1 arg2

Use the Edit button to change the script file, if required.

Step 6

On the Run Settings page, choose whether to execute the task immediately or schedule it for a later time. You can also set priority for the jobs. Choose from the following Execute options:

  • Now: Choose this option to run the script immediately.

  • As a scheduled job: Choose this option to execute the task as an asynchronous job. If you choose this option, set the time at which you want to run the script. The script runs at the scheduled time.

Step 7

Track the status of the job on the Job Manager page. The Job column displays "User-Script" for the script jobs. Once the job completes, import the output plan file into user space to visualize it. For more information, refer to Access output plan files from job manager.


Example: Run external scripts

This topic explains how to use an external Python script with Cisco Crosswork Planning to append a description to every interface in the network, demonstrating the process and command usage.

The sample Python script (ext_exe_eg.py) appends a description to every interface in the network with "My IGP metric is <value>."

Contents of ext_exe_eg.py:

import sys
from com.cisco.wae.opm.network import Network

src  = sys.argv[1]
dest = sys.argv[2]

srcNet =  Network(src)

for node in srcNet.model.nodes:
    cnt = 1
    for iface in node.interfaces:
        iface.description = 'My IGP metric is ' + str(iface.igp_metric)
        cnt = cnt + 1    

srcNet.write(dest)

Upload this script and run it from Job Manager using the steps mentioned in Run external scripts. Use this command:

ext_exe_eg.py input-plan.pln out-plan.pln

Once the job is completed successfully, download the output file (.tar file) from the Job Manager page, extract it, and import the updated plan file into the user space to access it.