public class MLContext extends Object
Modifier and Type | Class and Description |
---|---|
static class |
MLContext.ExplainLevel
The different explain levels supported by SystemML.
|
class |
MLContext.InternalProxy
Used internally by MLContextProxy.
|
Modifier and Type | Field and Description |
---|---|
static org.apache.log4j.Logger |
log
Logger for MLContext
|
static String |
SYSTEMML_MINIMUM_SPARK_VERSION
Minimum Spark version supported by SystemML.
|
Constructor and Description |
---|
MLContext(org.apache.spark.api.java.JavaSparkContext javaSparkContext)
Create an MLContext based on a JavaSparkContext for interaction with
SystemML on Spark.
|
MLContext(org.apache.spark.SparkContext sparkContext)
Create an MLContext based on a SparkContext for interaction with SystemML
on Spark.
|
MLContext(org.apache.spark.SparkContext sc,
boolean monitorPerformance)
Create an MLContext based on a SparkContext for interaction with SystemML
on Spark, optionally monitor performance.
|
Modifier and Type | Method and Description |
---|---|
String |
buildTime()
Obtain the SystemML jar file build time.
|
void |
close()
Closes the mlcontext, which includes the cleanup of static and local
state as well as scratch space and buffer pool cleanup.
|
MLResults |
execute(Script script)
Execute a DML or PYDML Script.
|
MLResults |
execute(Script script,
ScriptExecutor scriptExecutor)
Execute a DML or PYDML Script object using a ScriptExecutor.
|
static MLContext |
getActiveMLContext()
Retrieve the currently active MLContext.
|
MLContext.InternalProxy |
getInternalProxy()
Used internally by MLContextProxy.
|
Script |
getScriptByName(String name)
Obtain a script that has executed by name.
|
Map<String,Script> |
getScripts()
Obtain a map of the scripts that have executed.
|
org.apache.spark.SparkContext |
getSparkContext()
Obtain the SparkContext associated with this MLContext.
|
String |
history()
Display the history of scripts that have executed.
|
ProjectInfo |
info()
Obtain information about the project such as version and build time from
the manifest in the SystemML jar file.
|
boolean |
isExplain()
Whether or not an explanation of the DML/PYDML program should be output
to standard output.
|
boolean |
isMaintainSymbolTable()
Obtain whether or not all values should be maintained in the symbol table
after execution.
|
boolean |
isStatistics()
Whether or not statistics of the DML/PYDML program execution should be
output to standard output.
|
void |
resetConfig()
Reset configuration settings to default settings.
|
void |
setConfig(String configFilePath)
Set SystemML configuration based on a configuration file.
|
void |
setConfigProperty(String propertyName,
String propertyValue)
Set configuration property, such as
setConfigProperty("localtmpdir", "/tmp/systemml") . |
void |
setExplain(boolean explain)
Whether or not an explanation of the DML/PYDML program should be output
to standard output.
|
void |
setExplainLevel(MLContext.ExplainLevel explainLevel)
Set the level of program explanation that should be displayed if explain
is set to true.
|
void |
setExplainLevel(String explainLevel)
Set the level of program explanation that should be displayed if explain
is set to true.
|
void |
setMaintainSymbolTable(boolean maintainSymbolTable)
Set whether or not all values should be maintained in the symbol table
after execution.
|
void |
setStatistics(boolean statistics)
Whether or not statistics of the DML/PYDML program execution should be
output to standard output.
|
void |
setStatisticsMaxHeavyHitters(int maxHeavyHitters)
Sets the maximum number of heavy hitters that are printed out as part of
the statistics.
|
String |
version()
Obtain the SystemML version number.
|
public static final String SYSTEMML_MINIMUM_SPARK_VERSION
public static org.apache.log4j.Logger log
public MLContext(org.apache.spark.SparkContext sparkContext)
sparkContext
- SparkContextpublic MLContext(org.apache.spark.api.java.JavaSparkContext javaSparkContext)
javaSparkContext
- JavaSparkContextpublic MLContext(org.apache.spark.SparkContext sc, boolean monitorPerformance)
sc
- SparkContext object.monitorPerformance
- true
if performance should be monitored, false
otherwisepublic static MLContext getActiveMLContext()
public void resetConfig()
public void setConfigProperty(String propertyName, String propertyValue)
setConfigProperty("localtmpdir", "/tmp/systemml")
.propertyName
- property namepropertyValue
- property valuepublic MLResults execute(Script script)
script
- The DML or PYDML Script object to execute.public MLResults execute(Script script, ScriptExecutor scriptExecutor)
script
- the DML or PYDML Script objectscriptExecutor
- the ScriptExecutor that defines the script execution pathwaypublic void setConfig(String configFilePath)
configFilePath
- path to the configuration filepublic org.apache.spark.SparkContext getSparkContext()
public boolean isExplain()
true
if explanation should be output, false
otherwisepublic void setExplain(boolean explain)
explain
- true
if explanation should be output, false
otherwisepublic boolean isMaintainSymbolTable()
true
if all values should be maintained in the symbol
table, false
otherwisepublic void setMaintainSymbolTable(boolean maintainSymbolTable)
maintainSymbolTable
- true
if all values should be maintained in the symbol
table, false
otherwisepublic void setExplainLevel(MLContext.ExplainLevel explainLevel)
explainLevel
- the level of program explanationpublic void setExplainLevel(String explainLevel)
explainLevel
- string denoting program explanationpublic MLContext.InternalProxy getInternalProxy()
public boolean isStatistics()
true
if statistics should be output, false
otherwisepublic void setStatistics(boolean statistics)
statistics
- true
if statistics should be output, false
otherwisepublic void setStatisticsMaxHeavyHitters(int maxHeavyHitters)
maxHeavyHitters
- maximum number of heavy hitters to printpublic Map<String,Script> getScripts()
public Script getScriptByName(String name)
name
- the name of the scriptpublic String history()
public void close()
public ProjectInfo info()
public String version()
public String buildTime()
Copyright © 2017 The Apache Software Foundation. All rights reserved.