use of com.baidu.hugegraph.computer.k8s.crd.model.HugeGraphComputerJob in project hugegraph-computer by hugegraph.
the class KubernetesDriver method submitJob.
@Override
public String submitJob(String algorithmName, Map<String, String> params) {
HugeGraphComputerJob computerJob = new HugeGraphComputerJob();
String jobId = KubeUtil.genJobId(algorithmName);
String crName = KubeUtil.crName(jobId);
ObjectMeta meta = new ObjectMetaBuilder().withNamespace(this.namespace).withName(crName).build();
computerJob.setMetadata(meta);
ComputerJobSpec spec = this.computerJobSpec(this.defaultSpec, params);
Map<String, String> computerConf = this.computerConf(this.defaultConf, params);
this.checkComputerConf(computerConf, spec);
spec.withAlgorithmName(algorithmName).withJobId(jobId).withComputerConf(computerConf);
if (this.enableInternalAlgorithm && this.internalAlgorithms.contains(algorithmName)) {
spec.withImage(this.internalAlgorithmImageUrl);
} else if (StringUtils.isNotBlank(spec.getRemoteJarUri())) {
spec.withImage(this.frameworkImageUrl);
} else {
String imageUrl = this.buildImageUrl(algorithmName);
String jarFileDir = this.conf.get(KubeDriverOptions.JAR_FILE_DIR);
String jarFile = this.buildJarFile(jarFileDir, algorithmName);
spec.withImage(imageUrl).withJarFile(jarFile);
}
computerJob.setSpec(spec);
this.operation.createOrReplace(computerJob);
return jobId;
}
use of com.baidu.hugegraph.computer.k8s.crd.model.HugeGraphComputerJob in project hugegraph-computer by hugegraph.
the class KubernetesDriver method jobState.
@Override
public JobState jobState(String jobId, Map<String, String> params) {
String crName = KubeUtil.crName(jobId);
HugeGraphComputerJob computerJob = this.operation.withName(crName).get();
if (computerJob == null) {
return null;
}
return this.buildJobState(computerJob);
}
Aggregations