public abstract class DDPEngine extends java.lang.Object implements java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
protected java.util.Set<java.lang.String> |
_additionalJars
A set of additional jar names to send to the server.
|
protected java.lang.ClassLoader |
_classLoader
The ClassLoader class for loading implementation class for DDP actors.
|
protected java.lang.String |
_configDirStr
DDP Engine configuration directory.
|
protected static int |
_CONNECT_TIMEOUT
Timeout when seeing if server is running.
|
protected CompositeActor |
_container
The container of this director.
|
protected int |
_degreeOfParallelism
The default degree of parallelism for ddp pattern actors.
|
protected DDPDirector |
_director
The containing director.
|
protected java.lang.String |
_displayRedirectDir
Directory for display redirect.
|
protected java.lang.String |
_engineName
The name of the engine.
|
protected java.util.Map<java.lang.String,java.lang.String> |
_jobArgumentsMap
A collection of job arguments as key-values.
|
protected java.lang.String |
_jobDir
Directory for the current job.
|
protected java.lang.Object |
_jobLock
A lock for DDP jobs.
|
protected boolean |
_sameJVM
If true, run and use server in the same JVM as Kepler.
|
protected static java.lang.Object |
_serverStartStopLock
A static object used for synchronization.
|
protected static java.util.Map<java.lang.String,SingleInputPatternActor> |
_subWorkflows
A mapping of model name to model.
|
protected boolean |
_writeSubWorkflowsToFiles
If true, write the sub-workflows to files, otherwise pass them as
to in the configuration object.
|
Constructor and Description |
---|
DDPEngine(DDPDirector director)
Create a new DDPEngine.
|
Modifier and Type | Method and Description |
---|---|
protected void |
_addParameters()
Add parameters to the containing director.
|
protected void |
_checkConfigDir()
Check that the configuration directory is set and exists on the file system.
|
protected boolean |
_checkFilesBeforeStartingServer()
Check the existence of required files before starting the DDP server.
|
protected void |
_checkModel()
Check the container of this director for incorrect actors, etc.
|
protected void |
_checkModelForNonDDPActors(CompositeActor container)
Make sure the container only contains DDP actors.
|
protected boolean |
_checkServer(java.net.InetSocketAddress socketAddress,
java.lang.String startScriptStr)
Check if the DDP engine server is running.
|
protected void |
_copyParameters(DDPPatternActor sourceSubWorkflow,
DDPPatternActor destSubWorkflow)
Copy the workflow parameters from one sub-workflow to another including
the parameters in all the containers of the source.
|
protected void |
_createJobDirectory()
Create a new directory for this job.
|
protected abstract void |
_executeDDPJob()
Execute the DDP job.
|
protected java.util.List<java.net.URI> |
_getJarList()
Get a list of jars required for director to start.
|
protected static java.util.Map<java.lang.String,Variable> |
_getParametersInHierarchy(NamedObj namedObj)
Get the parameters for a NamedObj and all its containers.
|
protected java.net.InetSocketAddress |
_parseOutputFromStartingServer(java.io.InputStream input)
Parse the output from the script that starts the server.
|
protected void |
_removeParameters()
Remove engine-specific parameters from the director.
|
protected java.util.Map<java.lang.String,Type> |
_setPortTypes(DDPPatternActor actor)
Set the port types inside a cloned pattern actor.
|
void |
attributeChanged(Attribute attribute)
React to a parameter change.
|
java.lang.Object |
clone()
Clone the engine into the containing director's workspace.
|
java.lang.Object |
clone(Workspace workspace)
Clone the object into the specified workspace.
|
static void |
closeAllEffigies()
Close all the effigies created.
|
static void |
createEffigy(CompositeActor model)
Create an Effigy for a model so that windows may be opened by gui actors.
|
void |
fire()
Execute the engine.
|
java.lang.String |
getDisplayRedirectDir()
Get the directory to redirect display related actors.
|
static CompositeActor |
getModel(java.lang.String name)
Get the model for a specific name.
|
java.lang.String |
getName()
Get the name of the engine.
|
java.lang.String[] |
getServerTypes()
Valid types of servers that can be started.
|
boolean |
postfire()
Postfire the engine.
|
void |
preinitialize()
Initialize fields from parameters.
|
void |
stop()
Stop any running DDP jobs.
|
void |
wrapup()
Perform cleanup.
|
protected java.lang.String _configDirStr
protected java.lang.String _jobDir
protected java.lang.ClassLoader _classLoader
protected static final int _CONNECT_TIMEOUT
protected java.lang.String _displayRedirectDir
protected boolean _writeSubWorkflowsToFiles
protected CompositeActor _container
protected int _degreeOfParallelism
protected java.util.Map<java.lang.String,java.lang.String> _jobArgumentsMap
protected DDPDirector _director
protected java.lang.String _engineName
protected static final java.util.Map<java.lang.String,SingleInputPatternActor> _subWorkflows
protected boolean _sameJVM
protected java.util.Set<java.lang.String> _additionalJars
protected java.lang.Object _jobLock
protected static final java.lang.Object _serverStartStopLock
public DDPEngine(DDPDirector director) throws IllegalActionException, NameDuplicationException
director
- The director containing this engine.IllegalActionException
NameDuplicationException
public void attributeChanged(Attribute attribute) throws IllegalActionException
IllegalActionException
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public java.lang.Object clone(Workspace workspace) throws java.lang.CloneNotSupportedException
workspace
- The workspace for the cloned object.java.lang.CloneNotSupportedException
- Not thrown in this base classpublic static void closeAllEffigies() throws IllegalActionException
IllegalActionException
public static void createEffigy(CompositeActor model)
public java.lang.String getDisplayRedirectDir() throws IllegalActionException
IllegalActionException
public static CompositeActor getModel(java.lang.String name)
public final java.lang.String getName()
public java.lang.String[] getServerTypes()
public void fire() throws IllegalActionException
IllegalActionException
public boolean postfire() throws IllegalActionException
IllegalActionException
public void preinitialize() throws IllegalActionException
IllegalActionException
public void stop() throws IllegalActionException
IllegalActionException
public void wrapup() throws IllegalActionException
IllegalActionException
protected void _addParameters() throws IllegalActionException, NameDuplicationException
protected void _checkConfigDir() throws IllegalActionException
IllegalActionException
protected boolean _checkFilesBeforeStartingServer() throws IllegalActionException
IllegalActionException
protected void _checkModel() throws IllegalActionException
IllegalActionException
protected void _checkModelForNonDDPActors(CompositeActor container) throws IllegalActionException
IllegalActionException
protected boolean _checkServer(java.net.InetSocketAddress socketAddress, java.lang.String startScriptStr) throws IllegalActionException
socketAddress
- Host and port of the server to check.startScriptStr
- The script to start the server if not running.IllegalActionException
protected void _copyParameters(DDPPatternActor sourceSubWorkflow, DDPPatternActor destSubWorkflow) throws IllegalActionException
sourceSubWorkflow
- the source sub-workflowdestSubWorkflow
- the destination sub-workflowIllegalActionException
protected void _createJobDirectory() throws IllegalActionException
IllegalActionException
protected static java.util.Map<java.lang.String,Variable> _getParametersInHierarchy(NamedObj namedObj)
protected java.util.List<java.net.URI> _getJarList() throws IllegalActionException
IllegalActionException
protected abstract void _executeDDPJob() throws IllegalActionException
IllegalActionException
protected java.net.InetSocketAddress _parseOutputFromStartingServer(java.io.InputStream input) throws java.io.IOException, IllegalActionException
java.io.IOException
IllegalActionException
protected void _removeParameters() throws IllegalActionException, NameDuplicationException
protected java.util.Map<java.lang.String,Type> _setPortTypes(DDPPatternActor actor) throws IllegalActionException
actor
- the cloned actorIllegalActionException