fmeobjects.FMEWorkspaceRunner
This method retrieves the default value of the parameter specified by paramName. |
|
|
This method retrieves the label str that describes the parameter specified by paramName. |
This method determines if the specified parameter name on the workspace is an optional parameter. |
|
|
This method retrieves the parameter type of the specified parameter name. |
|
This method retrieves the possible parameter values of the specified parameter name. |
This method retrieves all the published parameter names on the specified workspace. |
|
|
Executes the workspace file specified. |
|
Executes the workspace file specified. |
Executes the workspace file specified using the parameter values. |
|
Executes the workspace file specified using the parameter values and FME directives. |
- class FMEWorkspaceRunner
FME Workspace Runner Class
init()
Create an instance of a workspace runner that can be used to run FME workspaces and retrieve information about FME workspaces.
- __init__(*args, **kwargs)
- 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 str is returned.
- Parameters:
- Return type:
- Returns:
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 str that describes the parameter specified by paramName.
- Parameters:
- Return type:
str or None
- Returns:
The parameter label str.
- 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:
- Return type:
bool or None
- Returns:
- 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:
- Return type:
str or None
- Returns:
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:
- Return type:
str or None
- Returns:
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 (str) – The path to the workspace to retrieve parameter names.
- Return type:
tuple[str] or
None
- Returns:
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, parentHandle)
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:
- Return type:
None
- Raises:
FMEException – An exception is raised if the running of the workspace failed.
- run(workspace, parentHandle)
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:
- Return type:
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:
- Return type:
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:
- Return type:
None
- Raises:
FMEException – An exception is raised if the workspace did not run successfully.