gr.uoa.di.madgik.workflow.adaptor
Class WorkflowGridAdaptor

java.lang.Object
  extended by gr.uoa.di.madgik.workflow.adaptor.WorkflowGridAdaptor
All Implemented Interfaces:
IWorkflowAdaptor

public class WorkflowGridAdaptor
extends Object
implements IWorkflowAdaptor

The Class WorkflowGridAdaptor constructs an ExecutionPlan that can mediate to submit a job described through a JDL file using a Grid UI node. After its submission the job is monitored for its status and once completed the output files are retrieved and stored in the Storage System.

The resources that are provided and need to be moved to the Grid UI are all transfered through the Storage System. They are stored once the plan is constructed and are then retrieved once the execution is started. This does not include the provided user proxy which is transfered as an attachment directly to the remote node to allow secure transfer if the SSL communication option is enabled.

The entire execution process takes place in the Grid UI node. This node is picked from the Information System and is currently chosen randomly from all the available ones. Currently once the node has been picked, the execution cannot be moved to a different one even if there is a problem communicating with that node. The execution that takes place is a sequential series of steps. These steps include - Contact the remote node - Retrieval of the data stored in the Storage System and these include the resources marked as one of AttachedGridResource.ResourceType#Config, AttachedGridResource.ResourceType#InData, AttachedGridResource.ResourceType#JDL - Submit the job using the provided JDL file and optionally any configuration additionally provided using the provided user proxy certificate - Go into a loop until either the job is completed or a timeout has expired (If a timeout has been set) - Wait for a defined period - Retrieve the job status - Retrieve the job logging info - Process the results of the above two steps - Check the reason the loop ended - If a timeout happened, cancel the job - If the job terminated successfully retrieve the output files of the job

TODO: - Handle errors and not let every exception stop the execution. - Allow for relocation of execution - If relocated cancel previous execution - Add SSL option in communication - Allow multiple JDLs and collection style submission - Delete files stored in Storage System if error in plan construction and after completion

Author:
gpapanikos

Field Summary
 long RetryOnErrorPeriod
           
 int RetryOnErrorTimes
           
 long Timeout
          Timeout period to wait for the job to be completed.
 long WaitPeriod
          The period every which the job status and logging info should be polled.
 
Constructor Summary
WorkflowGridAdaptor()
          Instantiates a new workflow grid JDL adaptor.
 
Method Summary
 void CreatePlan()
          Based on the provided resources, a call to this method will do all the needed processing and once completed a full execution plan will be created
 gr.uoa.di.madgik.execution.plan.ExecutionPlan GetCreatedPlan()
          Retrieves the created plan after the successful invocation of the IWorkflowAdaptor.CreatePlan()
 Set<IOutputResource> GetOutput()
          Retrieves the set of output resources containing info on the products of the workflow after the plan is executed.
 void SetAdaptorResources(IAdaptorResources Resources)
          Sets the resources that the adaptor needs to construct the plan.
 void SetExecutionId(String executionId)
          Sets the execution id which will be associated with the created plan
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

Timeout

public long Timeout
Timeout period to wait for the job to be completed. A Long.MIN_VALUE or Long.MAX_VALUE or a zero value indicates that no timeout should be used.


WaitPeriod

public long WaitPeriod
The period every which the job status and logging info should be polled.


RetryOnErrorPeriod

public long RetryOnErrorPeriod

RetryOnErrorTimes

public int RetryOnErrorTimes
Constructor Detail

WorkflowGridAdaptor

public WorkflowGridAdaptor()
Instantiates a new workflow grid JDL adaptor.

Method Detail

SetAdaptorResources

public void SetAdaptorResources(IAdaptorResources Resources)
                         throws WorkflowValidationException
Sets the resources that the adaptor needs to construct the plan. These must be of type AdaptorGridResources.

Specified by:
SetAdaptorResources in interface IWorkflowAdaptor
Parameters:
Resources - the resources needed
Throws:
WorkflowValidationException - Problem with the validity of one of the provided elements
See Also:
IWorkflowAdaptor.SetAdaptorResources(gr.uoa.di.madgik.workflow.adaptor.utils.IAdaptorResources)

SetExecutionId

public void SetExecutionId(String executionId)
Description copied from interface: IWorkflowAdaptor
Sets the execution id which will be associated with the created plan

Specified by:
SetExecutionId in interface IWorkflowAdaptor
Parameters:
executionId - The execution id

CreatePlan

public void CreatePlan()
                throws WorkflowValidationException,
                       WorkflowSerializationException,
                       WorkflowInternalErrorException,
                       WorkflowEnvironmentException
Description copied from interface: IWorkflowAdaptor
Based on the provided resources, a call to this method will do all the needed processing and once completed a full execution plan will be created

Specified by:
CreatePlan in interface IWorkflowAdaptor
Throws:
WorkflowValidationException - Problem with the validity of one of the provided elements
WorkflowSerializationException - Problem with the serialization of one of the provided elements
WorkflowInternalErrorException - An internal error has occurred
WorkflowEnvironmentException - There was a problem with the environment the Workflow Engine is contained

GetCreatedPlan

public gr.uoa.di.madgik.execution.plan.ExecutionPlan GetCreatedPlan()
Description copied from interface: IWorkflowAdaptor
Retrieves the created plan after the successful invocation of the IWorkflowAdaptor.CreatePlan()

Specified by:
GetCreatedPlan in interface IWorkflowAdaptor
Returns:
the execution plan

GetOutput

public Set<IOutputResource> GetOutput()
Retrieves the set of output resources containing info on the products of the workflow after the plan is executed. the resources are of type OutputSandboxGridResource

Specified by:
GetOutput in interface IWorkflowAdaptor
Returns:
A set of the output resources retrieval information
See Also:
IWorkflowAdaptor.GetOutput()


Copyright © 2012. All Rights Reserved.