Implementing Job Submission

Overview

Once user created a Job Description, she/he want to submit it to the grid: just click on the job and start action "Submit".

Wizard "Submit job" appears, in which user can select Job Service, to which job will be submitted:
Submit Job Wizard

In order to submit job to the grid you have to write a class implementing interface IGridJobService and register it by contributing to extension point: eu.geclipse.gria.griaElementCreators.
You have also to identify your job, so you must implement a class implementing interface IGridJobID
All these tasks are described below.

Implementing IGridJobService

  1. Generate new class, which implement interface eu.geclipse.core.model.IGridJobService
  2. Implement method canSubmit()
    This method should check if your job service can accept passed job description.
    For example:
    public boolean canSubmit( final IGridJobDescription desc ) {
      return ( desc instanceof JSDLJobDescription );
    }
    
  3. Implement method submitJob()
    This method should connect with remote job service, register new job using passed IGridJobDescription and return object IGridJobID allowing to identify job on the remote service.
    Optionally method submitJob() may:
    Example:
    public IGridJobID submitJob( final IGridJobDescription description,
                           final IVirtualOrganization vo,
                           final IProgressMonitor monitor )
        throws ProblemException {
        IGridJobID jobID = null;
        authenticate();
        
        String jobDesc = translateJsdl( description );
        JobIdentifier serviceJobId = this.webservice.submitJob( jobDesc );
        jobID = new GridgeJobID( serviceJobId, vo, this.serviceUri );
        
        return jobID;
    }
    	
  4. Create new class JobServiceCreator, which extends eu.geclipse.core.model.impl.AbstractGridElementCreator and implements interface eu.geclipse.core.model.ICreatorSourceMatcher.
    This class will create JobService objects from passed URI or from passed IGridJobID.
  5. Implement method boolean canCreate( final Object source ).
    Return true if you detect that passed source is an URI to your remote job service.
    Return true also if you detect that passed source is IGridJobID for job, which was previously submitted by your IGridJobService. Example:
      public boolean canCreate( final Object source ) {
        boolean canCreate = false;
        
        if( source instanceof URI ) {
          URI uri = ( URI )source;
          Path servicePath = new Path( uri.getPath() );
          canCreate = new Path( "yourmiddeware/services/jobService" ).isPrefixOf( servicePath );
        } if( source instanceof YourMiddlewareJobID ) {
          canCreate = true;
        }
    
        return canCreate;
      }
  6. Implement method IGridElement create( final IGridContainer parent )
    Create your job service object from passed URI or IGridJobID.
    Example:
      public IGridElement create( final IGridContainer parent ) {
        IGridElement service = null;
        
        Object source = getSource();
    
        if( source instanceof URI ) {
          URI uri = ( URI )source;
          service = new YourJobService( uri );      
        } else if( source instanceof YourMiddlewareJobID ) {
          YourMiddlewareJobID jobID = ( YourMiddlewareJobID )source;
          service = new YourJobService( jobID.getJobServiceUri() );
        }
        
        return service;
      }
  7. Contribute to extension point: eu.geclipse.core.gridElementCreator (open file plugin.xml on page "Extensions")
    Set following attributes describing contribution to this extension-point:

Implementing IGridJobID

Object implementing eu.geclipse.core.model.IGridJobID is passed to every method, which deal with submitted job. It should contain all information needed to identify particular job on remote service.
Following steps have to be done to implement IGridJobID:
  1. Create new class, which extends abstract class eu.geclipse.core.jobs.GridJobID.
    This class adds serialization features to IGridJobID.
  2. Store in this class URI to job service, to which job was submitted. It allows in the future to manage job using only IGridJobID object.
  3. If you want to serialize more data (e.g. URI to job service) in your IGridJobID implementation - just override following methods:
  4. Contribute to extension point eu.geclipse.core.jobs.jobID
    Set following attributes describing contribution to this extension-point:

Testing

Now you can test your job service. Don't forget to add URI to your job service to Virtual Organization.
If you don't have implemented specialized VO for your middleware, just create Generic VO, add to it new service. As service type select your just created job service and type correct URI to the service.