Table of Contents
The Job Submission Portlet provides a general navigation system for listing, specifying, viewing and managing jobs (stopping, migrating, deleting, etc). It supports the ability to plugin custom user interfaces for each of its main navigation page. These custom user interfaces are described by a Job Profile. In this guide, we describe the design of the Job Submission Portlet and how to write and deploy custom job profiles for use in the Job Submission Portlet.
Like all portlets in Grid Portlets, the JobSubmissionPortlet class
extends from the base class ActionComponentPortlet. Therefore, all
of the user interfaces in the JobSubmissionPortlet extend from ActionComponent.
For more information about action components, see the
Action Component Developer's Guide.
The Job Submission Portlet displays job action components, action components that extend from
JobComponent, providing a navigation system for displaying the
following job action components:
Table 1. The Job Submission Portlet provides navigation for the following pages
| Java Interface | Page Title | Description |
|---|---|---|
JobListViewPage | Job List View Page | This is the first page that is loaded by the Job Submission Portlet. It displays the complete list of jobs that have been submitted by a user from Grid Portlets. This page is also displayed anytime the user clicks . |
DeletedJobListViewPage | Deleted Job List View Page | This page is displayed after a list of jobs have been deleted by a user. |
JobViewPage | Job View Page | This page is loaded every time a job is viewed by a user. |
SubmittedJobViewPage | Submitted Job View Page | This page is loaded every time a job has just been submitted by a user. |
CanceledJobViewPage | Canceled Job View Page | This page is loaded every time a job has just been canceled by a user. |
DeletedJobViewPage | Deleted Job View Page | This page is loaded every time a job has just been deleted by a user. |
JobTypeEditPage | Job Type Edit Page |
This page is displayed when a user clicks if:
|
JobSpecEditPage | Job Specification Edit Page List | The Job Submission Portlet supports a simple job specification wizard whereby a job profile can describe a list of pages for editing a job specification. The job submission portlet will create a wizard if more than one page is provided by a job profile. |
JobSpecViewPage | Job Specification View Page | This page is loaded every time a job specfication is viewed by a user. |
MigratedJobViewPage | Migrated Job View Page |
This page is loaded every time a job has just been migrated by a user.
The ability to migrate a job from the Job Submission Portlet depends on whether:
|
The Job Submission Portlet supports the ability to plugin custom pages with the concept of a job profile. A job profile contains a description and tels the Job Submission Portlet which action component to display for each of the pages the Job Submission Portlet defines for interacting with a job (specifying, viewing, deleting, etc).
Job profiles get associated with jobs during the job specification process, i.e. when a user clicks . If there is only one job profile in the registry (which is typically the “Generic Job Profile”), then only the job spec edit pages from that profile will be loaded and the resulting job will have that job profile associated with it. If there, is more than one job profile available, the user will be presented with a display for choosing one of the available job profiles. Whenever subsequent pages for the resulting job are loaded, such as the Job View Page or the Deleted Job View Page, then the Job Submission Portlet will load the action components described by the associated job profile.
Otherwise, in the event that there is no job profile already associated with the job, say when a user selects to view a job from the Job List View Page, or if the job profile associated with the given job is not currently registered in the Job Profile Registry Service, then the default job profile (typically the “Generic Job Profile”) will be used for interacting with the job.
The Job Submission Portlet supports the ability to plugin custom pages with the concept of a
job profile.
A job profile is represented by a job-profile
entry in a file called /WEB-INF/JobProfiles.xml. Each Grid Portlet project that
provides job profiles must deploy this file to its target web application directory. The file looks like so:
<job-profiles>
<job-profile
key="YourJobProfileKey"
description="YourJobProfileDescription">
<!-- OPTIONAL PAGE ENTRIES
<job-view-page>YourJobViewPage</job-view-page>
<submitted-job-view-page>YourSubmittedJobViewPage</submitted-job-view-page>
<canceled-job-view-page>YourCanceledJobViewPage</canceled-job-view-page>
<deleted-job-view-page>YourDeletedJobViewPage</deleted-job-view-page>
<job-spec-view-page>YourJobSpecViewPage</job-spec-view-page>
<job-spec-edit-page>YourJobSpecEditPage1</job-spec-edit-page>
<job-spec-edit-page>YourJobSpecEditPage2</job-spec-edit-page>
<job-spec-edit-page>YourJobSpecEditPageEtc...</job-spec-edit-page>
<migrated-job-view-page>YourMigratedJobViewPage</migrated-job-view-page>
-->
</job-profile>
<!-- Specify as many job-profile entries as you want -->
</job-profiles>
Each job-profile entry gets marshaled to a JobProfile.
The important thing to keep in mind is that each page entry gets mapped to a specific method
of JobProfile and the JobSubmissionPortlet will call
these methods to determine which action components to load for a given job profile.
Thus, each page class entry must be an ActionComponent that
implements the interface expected by the JobSubmissionPortlet.
These mappings are described below.
Table 2. Page Entry to Job Page Interface Table
| Job Profile Page Entry | Job Profile Method | Java Interface |
|---|---|---|
| <job-view-page> | getJobViewPageClass() | JobViewPage |
| <submitted-job-view-page> | getSubmittedJobViewPageClass() | SubmittedJobViewPage |
| <canceled-job-view-page> | getCanceledJobViewPageClass() | CanceledJobViewPage |
| <deleted-job-view-page> | getDeletedJobViewPageClass() | DeletedJobViewPage |
| <job-spec-view-page> | getJobSpecViewPageClass() | JobSpecViewPage |
| <job-spec-edit-page> | getJobViewPageClass() | JobSpecEditPage |
| <migrated-job-view-page> | getMigratedJobViewPageClass() | MigratedJobViewPage |
To illustrate this point, the Grid Portlets project describes the "Generic Application" job profile in
its own /WEB-INF/JobProfiles.xml.
<job-profile
key="org.gridlab.gridsphere.services.ui.job.generic"
description="Generic user interface for submitting jobs">
<job-view-page>org.gridlab.gridsphere.services.ui.job.generic.GenericJobSpecViewPage</job-view-page>
<job-spec-view-page>org.gridlab.gridsphere.services.ui.job.generic.GenericJobSpecViewPage</job-spec-view-page>
<job-spec-edit-page>org.gridlab.gridsphere.services.ui.job.generic.GenericApplicationSpecEditPage</job-spec-edit-page>
<job-spec-edit-page>org.gridlab.gridsphere.services.ui.job.generic.GenericResourceSpecEditPage</job-spec-edit-page>
<job-spec-edit-page>org.gridlab.gridsphere.services.ui.job.generic.GenericJobSpecConfirmPage</job-spec-edit-page>
</job-profile>
![]() | Tip |
|---|---|
If you have defined your own job profile in a Grid portlet project, it is actually possible to remove the
Generic Job Profile from use in the Job Submission Portlet simply by commenting out the above entry
in $CATALINA_HOME/webapps/gridportlets/WEB-INF/JobProfiles.xml. This means you can
override Grid Portlets default job submission interfaces altogether, if so desired.
|
Developing a custom job profile amounts to implementing the particular pages
that you wish to overrride from the Generic Job Profile and then adding a job-profile
entry to your Grid portlet project /WEB-INF/JobProfiles.xml. The required steps are
summarized below:
Create a Grid portlet project. Grid Portlets offers two ant targets for doing so:
To create a new project from scratch, run ant new-project and
follow its instructions. This is similar to the new-project target in GridSphere.
It will create a new portlet project in the projects directory
of GridSphere that includes support for developing new action components and job profiles.
To modify an existing portlet project to support development of action components and
job profiles, run ant update-project and
follow its instructions. This is similar to the update-project target in GridSphere.
It will update an existing portlet project in the projects directory
of GridSphere with the latest project files from GridSpehre and Grid Portlets.
Implement the page interfaces you want to override from GenericJobProfile.
For example, if you wish to override the "Job View Page", then write an
ActionComponent that implements the JobViewPage interface.
In the job-profile entry, specify the key attribute,
which is used for displaying the localized title of your job profile in the Job Type Edit Page, and the
description (in case the localized key is not found). Then specify the page
class entries you wish to override GenericJobProfile. For example, if you wish
to override the "Job View Page", then specify your JobViewPage implementation
in the job-view-page.
Make sure to specify the ActionComponent classes you developed in
/WEB-INF/ActionComponentTypes.xml. Otherwise, the
JobSubmissionPortlet will fail when attempting to create the
action components you specified in your page entries.
The most important classes you should know about are JobComponent, which is a
convenient class to extend from, and GenericJobProfile, from which all custom
job profiles extend. You should also remember that any page entry you specify in your job profile
must implement the appropriate interface.
The JobComponent class extends ActionComponent
to provide methods for getting job anb job specfication objects from portlet requests. It also
gets a handle to the JobSubmissionService and other useful services in
its onInit method.
A JobProfile is marshaled from an xml entry in
/WEB-INF/JobProfiles.xml and specifies which action
components correspond to which of the Job Submission Portlet pages described above.
Each Grid Portlet project deploys a JobProfileProvider,
which registers the job profiles that have been defined
in its own job profile registry to the Job Profile Registry Service.
JobProfileRegistry - A job profile registry marshals job
profiles defined in /WEB-INF/JobProfiles.xml to java objects.