GR:Gravity/Job Management

From Remain Software
Jump to navigation Jump to search

Job Management

This section describes the Job Management in Gravity which is the task of a job service. Before delving into the details, this is the essence of all that Gravity Job management tale is about:

Gravity manages job services → A job service manages subsystems → A subsystem manages job queues and job templates → A job queue manages jobs.

In addition to being OSGi-ready, job and subsystem services are REST-ful as well enabling a Gravity user to manage jobs both on local and remote machines seamlessly from the same UI.

Job Management Perspective

You can open the perspective by clicking on the Open Perspective shortcut on the Perspective bar. Gr open perspective.png

Job perspective.png

Job Management View

The following is a screenshot of the Job Management view which is the entry point to interact with jobs.
Let's have a look at this view and see how it's built.

Job view exploded.png

The Job Management view will show locally running job and subsystem services as well as those running on a remote machine which are discovered by Gravity.
Each node in this tree view reacts on double and/or right clicks.
The Job Management view (the screenshot above) has, roughly speaking, the following tree structure: (Nodes within [ ] are variable ones.)

Job Management This is the tree root

Job Services All discovered job services (both local and remote ones) will show up under this node.
[some job service], for example: Discoverd Job service.png running on machine with the shown IP address
Subsystems All discovered subsystems belonging to the parent job service Discoverd Job service.png will show up under this node.
[some subsystem service], for example: Subsystem service.png
Job Templates All discovered job templates within the parent subsystem Subsystem service.png will show up under this node.
[some job template] , for example: Job templates example.png
Queues All job queues defined within the parent subsystem Subsystem service.png. Queues are either trigger-time, FIFO or priority based
Scheduled Jobs A full-fledged time-triggered 'queue' based on Quartz scheduling. There is only one of such queues per system and it's created by Gravity itself: Time job queue example.png.
[some time-trigger based job]. For example: Quartz job example.png
[some user-created job Queue] A job queue which is either FIFO(First In, First Out) or priority based. Such queues are created by the user. For example: Fifo job queue example.png
[some FIFO or priority based job instance]. For example: Fifo based job example.png.

Subsystem

A job service manages one or more subsystem services. A subsystem service is responsible for job queues and job templates within its borders.

Subsystem Overview

Double-click the subsystem node you want to open. In our case: Subsystem service.png. An editor is opened. Click on the editor's foot-tabs to manage the subsystem's info, queues and jobs in action.

Subsystemview.png.

Job Queue

in Gravity, you can queue a job for execution based on its insertion order (FIFO), priority or trigger-time:

  • For the first two cases, you create and use either a FIFO or Priority queue. ( See how to create a new job queue here.)
  • For the last case you use the provided trigger-based queue Scheduled Jobs (..having this icon Time job queue example.png).

Job Queue Overview

Double-click a job queue to see its overview.

Job queue editor.png

Create a New Job Queue

To create and add a new job queue to a subsystem, right-click on node Subsystem service.png or JobsQueu.png, then choose for New Job Queue from the pop-up menu.
A wizard shows up prompting for this new job queue's fields, fill them in then press Finish. Your new job queue shows up in the view under JobsQueu.png node. (It may take a bit longer to show up if you're creating it on a remote subsystem).

Tip: Hover with your mouse over a field to get its tool tip with more details.
NewJobQueueDialog.png

Queueing Jobs

Jobs are instances created from templates. What Gravity will execute is a job instance, not the template itself. So, you can instantiate and execute as many jobs (instances) as you like from the same unique template
and have each job run with its own context/parameters. In the view, job templates are visible under node: Job Templates (Job templates node.png ).
You can open a template's editor by double-clicking its name.

Schedule job editor.png

You can queue/schedule your job by first right-clicking a template Schedule job.png. Or by clicking one of the two places in the template's editor as shown in the screenshot above.

You get, then, a wizard opened where you can step by step configure your job. This wizard provides some useful info by clicking Help button.

Schedule job wizard.png

From your new job wizard, select the queue you want your job to be added to.

  • Selecting Scheduled Jobs, which is time-based, requires entering either a CRON expression (click wizard's Help for some CRON details) or the job's start, repeat and end time sections.
  • Selecting a FIFO/Priority queue omits the rest of the fields as they're not needed.

Click 'Next' if you want to pass specific parameter values to this job instance. Then click Finish'. Your newly created job should show up in the view under your queue of choice.