public class Script extends Object
Constructor and Description |
---|
Script()
Script constructor, which by default creates a DML script.
|
Script(ScriptType scriptType)
Script constructor, specifying the type of script (
ScriptType.DML
or ScriptType.PYDML ). |
Script(String scriptString)
Script constructor, specifying the script content.
|
Script(String scriptString,
ScriptType scriptType)
Script constructor, specifying the script content and the type of script
(DML or PYDML).
|
Modifier and Type | Method and Description |
---|---|
void |
clearAll()
Clear the script string, inputs, outputs, and symbol table.
|
void |
clearInputs()
Clear the inputs.
|
void |
clearIO()
Clear the inputs and outputs, but not the symbol table.
|
void |
clearIOS()
Clear the inputs, outputs, and symbol table.
|
void |
clearOutputs()
Clear the outputs.
|
void |
clearSymbolTable()
Clear the symbol table.
|
String |
displayInputParameters()
Display the script input parameters.
|
String |
displayInputs()
Display the script inputs.
|
String |
displayInputVariables()
Display the script input variables.
|
String |
displayOutputs()
Display the script outputs.
|
String |
displayOutputVariables()
Display the script output variables.
|
String |
displaySymbolTable()
Display the script symbol table.
|
MLResults |
execute()
Execute the script and return the results as an MLResults object.
|
Map<String,Metadata> |
getInputMetadata()
Obtain an unmodifiable map of input matrix/frame metadata.
|
Map<String,Object> |
getInputParameters()
Obtain an unmodifiable map of all input parameters ($).
|
Map<String,Object> |
getInputs()
Obtain an unmodifiable map of all inputs (parameters ($) and variables).
|
Set<String> |
getInputVariables()
Obtain the input variable names as an unmodifiable set of strings.
|
String |
getName()
Obtain the script name.
|
Set<String> |
getOutputVariables()
Obtain the output variable names as an unmodifiable set of strings.
|
MLResults |
getResults()
Obtain the results of the script execution.
|
String |
getScriptExecutionString()
Generate the script execution string, which adds read/load/write/save
statements to the beginning and end of the script to execute.
|
ScriptExecutor |
getScriptExecutor()
Obtain the script executor used by this Script.
|
String |
getScriptString()
Obtain the script string.
|
ScriptType |
getScriptType()
Obtain the script type.
|
org.apache.sysml.runtime.controlprogram.LocalVariableMap |
getSymbolTable()
Obtain the symbol table, which is essentially a
HashMap<String, Data> representing variables and their values. |
Script |
in(scala.collection.Map<String,?> inputs)
Pass a Scala Map of inputs to the script.
|
Script |
in(Map<String,Object> inputs)
Pass a map of inputs to the script.
|
Script |
in(scala.collection.Seq<Object> inputs)
Pass a Scala Seq of inputs to the script.
|
Script |
in(String name,
Object value)
Register an input (parameter ($) or variable).
|
Script |
in(String name,
Object value,
Metadata metadata)
Register an input (parameter ($) or variable) with optional matrix
metadata.
|
String |
info()
Display information about the script as a String.
|
boolean |
isDML()
Is the script type DML?
|
boolean |
isPYDML()
Is the script type PYDML?
|
Script |
out(List<String> outputNames)
Register output variables.
|
Script |
out(scala.collection.Seq<String> outputNames)
Register output variables.
|
Script |
out(String... outputNames)
Register output variables.
|
Script |
out(String outputName)
Register an output variable.
|
MLResults |
results()
Obtain the results of the script execution.
|
Script |
setName(String name)
Set the script name.
|
void |
setResults(MLResults results)
Set the results of the script execution.
|
void |
setScriptExecutor(ScriptExecutor scriptExecutor)
Set the ScriptExecutor used by this Script.
|
Script |
setScriptString(String scriptString)
Set the script string.
|
void |
setScriptType(ScriptType scriptType)
Set the type of script (DML or PYDML).
|
String |
toString() |
public Script()
public Script(ScriptType scriptType)
ScriptType.DML
or ScriptType.PYDML
).scriptType
- ScriptType.DML
or ScriptType.PYDML
public Script(String scriptString)
scriptString
- the script content as a stringpublic Script(String scriptString, ScriptType scriptType)
scriptString
- the script content as a stringscriptType
- ScriptType.DML
or ScriptType.PYDML
public ScriptType getScriptType()
ScriptType.DML
or ScriptType.PYDML
public void setScriptType(ScriptType scriptType)
scriptType
- ScriptType.DML
or ScriptType.PYDML
public String getScriptString()
public Script setScriptString(String scriptString)
scriptString
- the script stringthis
Script object to allow chaining of methodspublic Set<String> getInputVariables()
public Set<String> getOutputVariables()
public org.apache.sysml.runtime.controlprogram.LocalVariableMap getSymbolTable()
HashMap<String, Data>
representing variables and their values.public Map<String,Object> getInputs()
public Map<String,Metadata> getInputMetadata()
public Script in(Map<String,Object> inputs)
inputs
- map of inputs (parameters ($) and variables).this
Script object to allow chaining of methodspublic Script in(scala.collection.Map<String,?> inputs)
Note that the Map
value type is not explicitly specified on this
method because [String, Any]
can't be recognized on the Java side
since Any
doesn't have an equivalent in the Java class hierarchy
(scala.Any
is a superclass of scala.AnyRef
, which is
equivalent to java.lang.Object
). Therefore, specifying
scala.collection.Map<String, Object>
as an input parameter to
this Java method is not encompassing enough and would require types such
as a scala.Double
to be cast using asInstanceOf[AnyRef]
.
inputs
- Scala Map of inputs (parameters ($) and variables).this
Script object to allow chaining of methodspublic Script in(scala.collection.Seq<Object> inputs)
inputs
- Scala Seq of inputs (parameters ($) and variables).this
Script object to allow chaining of methodspublic Map<String,Object> getInputParameters()
public Script in(String name, Object value)
name
- name of the inputvalue
- value of the inputthis
Script object to allow chaining of methodspublic Script in(String name, Object value, Metadata metadata)
name
- name of the inputvalue
- value of the inputmetadata
- optional matrix/frame metadatathis
Script object to allow chaining of methodspublic Script out(String outputName)
outputName
- name of the output variablethis
Script object to allow chaining of methodspublic Script out(String... outputNames)
outputNames
- names of the output variablesthis
Script object to allow chaining of methodspublic Script out(scala.collection.Seq<String> outputNames)
outputNames
- names of the output variablesthis
Script object to allow chaining of methodspublic Script out(List<String> outputNames)
outputNames
- names of the output variablesthis
Script object to allow chaining of methodspublic void clearIOS()
public void clearIO()
public void clearAll()
public void clearInputs()
public void clearOutputs()
public void clearSymbolTable()
public MLResults results()
public MLResults getResults()
public void setResults(MLResults results)
results
- the results of the script execution.public ScriptExecutor getScriptExecutor()
public void setScriptExecutor(ScriptExecutor scriptExecutor)
scriptExecutor
- the script executorpublic boolean isDML()
true
if the script type is DML, false
otherwisepublic boolean isPYDML()
true
if the script type is PYDML, false
otherwisepublic String getScriptExecutionString()
public String info()
public String displayInputs()
public String displayOutputs()
public String displayInputParameters()
public String displayInputVariables()
public String displayOutputVariables()
public String displaySymbolTable()
public String getName()
public Script setName(String name)
name
- the script namethis
Script object to allow chaining of methodspublic MLResults execute()
Copyright © 2017 The Apache Software Foundation. All rights reserved.