Running jobs

From ControlTier

Jump to: navigation, search


This document describes how to run saved Jobs with CTL Center. Non-Scheduled Jobs can be run at any time. Any running job can be observed as it runs, in a few different ways.

Contents

Description

CTL Center lets you execute Stored Jobs at any time, and the output of those Jobs can be observed as the Job is running. You can view a list of the currently running Jobs that is dynamically updated as the Jobs progress. Jobs can also be Killed if they need to be stopped.

Each Job has a record of every time it has been executed, and the output from those executions can be viewed.

Using the GUI

Running Jobs

Jobs can be run directly from the Jobs Page, or from a Job View Page. (For more about these pages, see: Creating jobs#The Jobs List and Job View pages.)

You can select some options prior to running the Job, or you can choose to run the Job immediately without changing any options.

Set Options and Run

To Run a Job from the Jobs List, click on the "Run Job…" button for the Job you want to run:

Run Job button

You will be presented with the "Choose Execution Options" form:

Choose Execution Options form

If there are any Command Options for the Command being run, you can change them here.

Command Options in the Choose Execution Options form

Options for commands can use an embedded Datestamp, which will automatically be updated with the date/time at the time of execution. Simply use a string like "${DATE:XXX}" replacing XXX with any of the Java SimpleDateFormat characters.


Seeing what Jobs are Running

Go to the View events page to view current executions.

Seeing Previously Run Jobs

In the Jobs List view, you can see the outcome of previous executions of Jobs by expanding the "More Information" section for the Job. You can click on any execution in the list to see the full execution state.

The Now Running Page will also list executions that have completed within the last hour.

To view the complete list of executions for a particular job, go to the Job View Page for the Job (click on its name in the Jobs List). Then click on the "Executions" link to show the list of previous executions:

Executions for a Job

The browser will be directed to the Events page with a listing of executions for that Job.

Execution events for Job

Killing Jobs

Jobs that are currently running can be Killed immediately.

WARNING: This feature should be used with caution, as it forcibly kills the Java Thread that the Job is running on. It may result in the CTL Center server becoming flaky. It is a deprecated feature of Java that is not recommended to be used, so do so only when extremely necessary.

From the Events view Now Running section, or in the Jobs List view, click on the "Kill Job Now" button for the running Job:

Kill Job Now button

When prompted "Really kill this job?" Click the "Yes" button.

Really kill this job?

This feature should be used with caution.

Following Running Jobs

Once you have started running a Job, you can follow the output of the job in the Execution Follow page.

In the Jobs List View, click on the Execution you want to follow from the "More information" section of a Job.

From the Now Running page, click on the "output »" link for the running execution. output link

You will see the Execution Follow Page:

Follow page

There are three "follow" modes which you can use to watch the progress of a Job:

  1. Tail Output - this is the default mode. It will update the view with the last 20 lines of output from the Job. The number of output lines can be changed. (This is equivalent to a unix tail -f command.)
    • Tail View Mode
  2. Browse Output - This view groups the output messages into the context in which they were produced, allowing you to get a higher-level view of the various Commands that might be running. This is useful for viewing Workflow commands, or any commands that dispatch other commands. Each context can be expanded to show the output it produced, or completely collapsed to hide the textual detail.
    • Browse View mode
  3. Process View - This view shows a hierarchical representation of the Command and the Workflow or Dispatch commands that it invokes. It can give a better sense of how the command is being executed in relation to the data Model that governs the command dispatching mechanism.
    • Process View mode

Downloading Job Output

Once a Job has finished executing, the output log can be downloaded from CTL Center.

From the Jobs List page or the Now Running page, click on the File icon shown next to the completed Job execution:

Download log button

From the Execution Follow page for the execution, click on the "Download" link on the right side:

Download output link

This file will contain the full text output from the Command execution.

Using the CLI

Shell utilities are provided to enable a command line interface to Job control.

Starting jobs

The ctl-run command provides a shell interface to starting a Job in CTL Center.

$ ctl-run -j apps/web/restart
Job execution started:
[51] restart <http://strongbad:8080/ctlcenter/execution/follow/51>

Seeing what Jobs are running

The ctl-queue command lists currently executing jobs.

$ ctl-queue 
Queue: 2 items
[58] workflow: Workflow:(threadcount:1){ [command( scriptfile: /Users/alexh/bin/pushdeploy.sh scriptargs: 30 10 8088)] } <http://strongbad:8080/ctlcenter/execution/follow/58>
[57] workflow: Workflow:(threadcount:1){ [command( scriptfile: /Users/alexh/bin/checkagain.sh scriptargs: 30 10 8081)] } <http://strongbad:8080/ctlcenter/execution/follow/57>

Killing running jobs

The ctl-queue also provides an action to kill running jobs. To kill a running command, use ctl-queue kill and specify the execution id.

Here both jobs listed in the above section are killed:

$ ctl-queue kill -e 58
ctl-queue kill: success. [58] Job status: killed
 
$ ctl-queue kill -e 57
ctl-queue kill: success. [57] Job status: killed
Personal tools
Namespaces
Variants
Actions
Navigation
Communication
Development
Toolbox
Print/export