use of edu.iu.dsc.tws.rsched.schedulers.k8s.master.JobTerminator in project twister2 by DSC-SPIDAL.
the class KubernetesLauncher method startJobMasterOnClient.
/**
* start the JobMaster locally on submitting client
* this is a blocking call
* it finishes after the job has completed
*/
private boolean startJobMasterOnClient(JobAPI.Job job) {
// get Dashboard IP address from dashboard service name
String dashAddress = JobMasterContext.dashboardHost(config);
// get the IP address for the service name by querying Kubernetes master
if (dashAddress.endsWith("svc.cluster.local")) {
String dashIP = getDashboardIP(dashAddress);
String dashURL = "http://" + dashIP;
if (dashIP == null) {
LOG.warning("Could not get Dashboard server IP address from dashboard service name: " + dashAddress + " will not connect to Dashboard. *****");
dashURL = null;
}
config = JobMasterContext.updateDashboardHost(config, dashURL);
LOG.info("Dashboard server HTTP URL: " + dashURL);
}
String hostAdress = RequestObjectBuilder.getJobMasterIP();
JobMasterAPI.NodeInfo nodeInfo = NodeInfoUtils.createNodeInfo(hostAdress, null, null);
K8sScaler k8sScaler = new K8sScaler(config, job, controller);
JobMasterAPI.JobMasterState initialState = JobMasterAPI.JobMasterState.JM_STARTED;
JobTerminator jobTerminator = new JobTerminator(config, controller);
JobMaster jobMaster = new JobMaster(config, hostAdress, jobTerminator, job, nodeInfo, k8sScaler, initialState);
jobMaster.addShutdownHook(true);
// jobMaster.startJobMasterThreaded();
try {
jobMaster.startJobMasterBlocking();
} catch (Twister2Exception e) {
LOG.log(Level.SEVERE, e.getMessage(), e);
return false;
}
return true;
}
Aggregations