com.xpatterns.spark.core.java.PythonSparkJobRestClient Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xpatterns-spark-api Show documentation
Show all versions of xpatterns-spark-api Show documentation
The API for Spark-API.
Contains the SparkJob interface that must be extended in order to run jobs on the server.
The newest version!
package com.xpatterns.spark.core.java;
import java.util.Date;
import java.util.HashSet;
/**
* Created by radum on 10.04.2014.
*/
public abstract class PythonSparkJobRestClient extends SparkJobRestClient {
private String XPATTERNS_SJS_BRIDGE_CLASS_PATH = "com.spark.job.server.python.XPatternsPythonSparkBridge";
public PythonSparkJobRestClient(String uri) {
super(uri);
}
public String getXPatternsSjsBridgeClassPath() {
return XPATTERNS_SJS_BRIDGE_CLASS_PATH;
}
public String launchXPatternsSparkJob(String mainPythonFile, String resources, HashSet parameters, String context, Boolean sync) throws Exception {
StringBuffer input = new StringBuffer("mainPythonFile=" + mainPythonFile + "\n resources=\"" + resources + "\"");
if (parameters != null) {
input.append("\n");
for (String pair : parameters) {
input.append(pair);
input.append("\n");
}
}
input.append("xpatterns_submission_date=" + CUSTOM_DATE.format(new Date()) + "\n");
return launchJob(input.toString(), context, sync);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy