Module fmeobjects :: Class FMEWorkspaceRunner
[hide private]
[frames] | no frames]

Class FMEWorkspaceRunner

object --+
         |
        FMEWorkspaceRunner

init()

Create an instance of a workspace runner that can be used to run FME workspaces and retrieve information about FME workspaces.

Instance Methods [hide private]
 
__init__()
x.__init__(...) initializes x; see help(type(x)) for signature
a new object with type S, a subtype of T
__new__(T, S, ...)
string
getParamDefaultValue(workspace, paramName)
This method retrieves the default value of the parameter specified by paramName.
string or None
getParamLabel(workspace, paramName)
This method retrieves the label string that describes the parameter specified by paramName.
bool or None
getParamOptional(workspace, paramName)
This method determines if the specified parameter name on the workspace is an optional parameter.
string or None
getParamType(workspace, paramName)
This method retrieves the parameter type of the specified parameter name
string or None
getParamValues(workspace, paramName)
This method retrieves the possible parameter values of the specified parameter name.
tuple of string or None
getPublishedParamNames(workspace)
This method retrieves all the published parameter names on the specified workspace.
None
promptRun(workspace)
Executes the workspace file specified.
None
run(workspace)
Executes the workspace file specified.
None
runWithParameters(workspace, parameters)
Executes the workspace file specified using the parameter values.
None
runWithParametersAndDirectives(workspace, parameters, directives)
Executes the workspace file specified using the parameter values and FME directives.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__()
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__

__new__(T, S, ...)

 
Returns: a new object with type S, a subtype of T
Overrides: object.__new__

getParamDefaultValue(workspace, paramName)

 

This method retrieves the default value of the parameter specified by paramName. If the the parameter does not have a default value, an empty string is returned.

Parameters:
  • workspace (string) - The path to the workspace containing parameter name.
  • paramName (string) - The parameter name of the default value to retrieve.
Returns: string
The parameter default value.
Raises:
  • FMEException - An exception is raised if the parameter is not found on the workspace.

getParamLabel(workspace, paramName)

 

This method retrieves the label string that describes the parameter specified by paramName.

Parameters:
  • workspace (string) - The path to the workspace containing parameter name.
  • paramName (string) - The parameter name of the label to retrieve.
Returns: string or None
The parameter label string.
Raises:
  • FMEException - An exception is raised if the parameter is not found on the workspace.

getParamOptional(workspace, paramName)

 

This method determines if the specified parameter name on the workspace is an optional parameter.

Parameters:
  • workspace (string) - The path to the workspace containing parameter name.
  • paramName (string) - The parameter name to determine if optional.
Returns: bool or None
True if the parameter is optional, False otherwise.
Raises:
  • FMEException - An exception is raised if the parameter is not found on the workspace.

getParamType(workspace, paramName)

 

This method retrieves the parameter type of the specified parameter name

A full description of each parameter type can be found here:

http://docs.safe.com/fme/html/FME_GuiType/

Parameters:
  • workspace (string) - The path to the workspace containing parameter name.
  • paramName (string) - The parameter name of the type to retrieve.
Returns: string or None
The parameter type.
Raises:
  • FMEException - An exception is raised if the parameter is not found on the workspace.

getParamValues(workspace, paramName)

 

This method retrieves the possible parameter values of the specified parameter name. Parameter value availability is dependent on the parameter type of the parameter.

Here are some examples of the format the parameter values are returned as, given a certain parameter type:

  • "INTEGER":
    • paramValues is empty because possible values is the set of integers
  • "CHOICE": < value >[%< value2 >]*
    • Each possible value is separated by a '%'.
  • "LOOKUP_CHOICE": < displayValue >[,< returnValue >][%< displayValue >[,< returnValue >]]*
    • The display values and return values are separated by a ',', with the return values being optional. Each possible "pair" are separated by a '%'.
  • "FILENAME": < filterDes >|< filter >[|< filterDes2 >|< filter2 >]*
    • The filter descriptions and the filter extension types are separated by a '|'.

A full description of the parameter value format for each parameter type can be found here:

http://docs.safe.com/fme/html/FME_GuiType/

Parameters:
  • workspace (string) - The path to the workspace containing parameter name.
  • paramName (string) - The parameter name of the values to retrieve.
Returns: string or None
The possible parameter values.
Raises:
  • FMEException - An exception is raised if the parameter is not found on the workspace.

getPublishedParamNames(workspace)

 

This method retrieves all the published parameter names on the specified workspace.

Parameters:
  • workspace (string) - The path to the workspace to retrieve parameter names.
Returns: tuple of string or None
The published parameter names.
Raises:
  • FMEException - An exception is raised if the published parameter names could not be retrieved on the workspace specified.

promptRun(workspace)

 

Executes the workspace file specified. This method will always prompt for any published parameters before running the workspace.

This method will run mapping files in addition to workspaces. However, workspaces are preferred over mapping files due to the configuration ease workspaces provide.

Parameters:
  • workspace (string) - The path to the workspace to run.
Returns: None
Raises:
  • FMEException - An exception is raised if the running of the workspace failed.

run(workspace)

 

Executes the workspace file specified. The first time this method is called on a workspace, any published parameters will be prompted for before the workspace is run. Subsequent calls to this method with the same workspace will not prompt for published parameters. The published parameters specified during the first call to this method will be used in the subsequent calls.

This method will run mapping files in addition to workspaces. However, workspaces are preferred over mapping files due to the configuration ease workspaces provide.

Parameters:
  • workspace (string) - The path to the workspace to run.
Returns: None
Raises:
  • FMEException - An exception is raised if the running of the workspace failed.

runWithParameters(workspace, parameters)

 

Executes the workspace file specified using the parameter values. The parameter values are to be specified as name/value pairs. For example, for the pair SHAPE_IN_DISSOLVE_HOLES_SHAPE/no:

>>> runner.runWithParameters('workspace.fmw', {'SHAPE_IN_DISSOLVE_HOLES_SHAPE', 'no'})
Parameters:
  • workspace (string) - The path to the workspace to run.
  • parameters (dict of parameters) - Parameter name and values dictionary.
Returns: None
Raises:
  • FMEException - An exception is raised if the running of the workspace failed.

runWithParametersAndDirectives(workspace, parameters, directives)

 

Executes the workspace file specified using the parameter values and FME directives. Both the parameter values and FME directives are to be specified as name/value pairs. For example, for the parameter pair SHAPE_IN_DISSOLVE_HOLES_SHAPE/no and FME directive pair LOG_FILENAME/out.log:

>>> IFMEStringArray* parameters = fmeSession->createStringArray();
>>> parameters->append("SHAPE_IN_DISSOLVE_HOLES_SHAPE");
>>> parameters->append("no");
>>> IFMEStringArray* directives = fmeSession->createStringArray();
>>> parameters->append("LOG_FILENAME");
>>> parameters->append("out.log");
>>> runner->runWithParametersAndDirectives(*workspace, *parameters, *directives);
Parameters:
  • workspace (string) - The path to the workspace to run.
  • parameters (dict of parameters) - Parameter name and values dictionary.
  • directives (dict of directives) - Directive name and values dictionary.
Returns: None
Raises:
  • FMEException - An exception is raised if the workspace did not run successfully.