use of com.qlangtech.tis.datax.job.DataXJobWorker in project tis by qlangtech.
the class DataxAction method doLaunchDataxWorker.
/**
* 启动DataX执行器
*
* @param context
*/
@Func(value = PermissionConstant.DATAX_MANAGE)
public void doLaunchDataxWorker(Context context) {
DataXJobWorker dataxJobWorker = DataXJobWorker.getJobWorker(this.getK8SJobWorkerTargetName());
if (dataxJobWorker == null) {
throw new IllegalStateException("dataxJobWorker can not be null,relevant target type:" + this.getK8SJobWorkerTargetName());
}
if (dataxJobWorker.inService()) {
throw new IllegalStateException("dataxJobWorker is in serivce ,can not launch repeat");
}
dataxJobWorker.launchService();
try {
Thread.sleep(4000l);
} catch (InterruptedException e) {
}
this.doGetJobWorkerMeta(context);
AjaxValve.ActionExecResult actionExecResult = MockContext.getActionExecResult();
DataXJobWorkerStatus jobWorkerStatus = (DataXJobWorkerStatus) actionExecResult.getBizResult();
if (jobWorkerStatus == null || !jobWorkerStatus.isK8sReplicationControllerCreated()) {
throw new IllegalStateException("Job Controller launch faild please contract administer");
}
this.addActionMessage(context, "已经成功启动DataX执行器");
}
use of com.qlangtech.tis.datax.job.DataXJobWorker in project tis by qlangtech.
the class DataxAction method doSaveDataxWorker.
/**
* 保存K8S dataX worker
*
* @param context
*/
@Func(value = PermissionConstant.DATAX_MANAGE)
public void doSaveDataxWorker(Context context) {
JSONObject postContent = this.parseJsonPost();
JSONObject k8sSpec = postContent.getJSONObject("k8sSpec");
IncrUtils.IncrSpecResult incrSpecResult = IncrUtils.parseIncrSpec(context, k8sSpec, this);
if (!incrSpecResult.isSuccess()) {
return;
}
TargetResName resName = this.getK8SJobWorkerTargetName();
DataXJobWorker worker = DataXJobWorker.getJobWorker(resName);
worker.setReplicasSpec(incrSpecResult.getSpec());
if (incrSpecResult.hpa != null) {
worker.setHpa(incrSpecResult.hpa);
}
DataXJobWorker.setJobWorker(resName, worker);
}
use of com.qlangtech.tis.datax.job.DataXJobWorker in project tis by qlangtech.
the class DataxAction method doRelaunchPodProcess.
@Func(value = PermissionConstant.DATAX_MANAGE, sideEffect = false)
public void doRelaunchPodProcess(Context context) throws Exception {
DataXJobWorker jobWorker = DataXJobWorker.getJobWorker(this.getK8SJobWorkerTargetName());
String podName = this.getString("podName");
jobWorker.relaunch(podName);
// PluginStore<IncrStreamFactory> incrStreamStore = getIncrStreamFactoryStore(this, true);
// IncrStreamFactory incrStream = incrStreamStore.getPlugin();
// IRCController incrSync = incrStream.getIncrSync();
// incrSync.relaunch(this.getCollectionName());
}
use of com.qlangtech.tis.datax.job.DataXJobWorker in project tis by qlangtech.
the class DataxAction method doRemoveDataxWorker.
/**
* 删除dataX实例
*
* @param context
*/
@Func(value = PermissionConstant.DATAX_MANAGE)
public void doRemoveDataxWorker(Context context) {
DataXJobWorker jobWorker = DataXJobWorker.getJobWorker(this.getK8SJobWorkerTargetName());
// DataXJobWorker dataxJobWorker = dataxJobWorkerStore.getPlugin();
if (!jobWorker.inService()) {
throw new IllegalStateException("dataxJobWorker is not in serivce ,can not remove");
}
jobWorker.remove();
this.addActionMessage(context, "DataX Worker 已经被删除");
}
use of com.qlangtech.tis.datax.job.DataXJobWorker in project tis by qlangtech.
the class DataxAction method doWorkerDesc.
@Func(value = PermissionConstant.DATAX_MANAGE, sideEffect = false)
public void doWorkerDesc(Context context) {
final TargetResName targetName = getK8SJobWorkerTargetName();
DataXJobWorker jobWorker = DataXJobWorker.getJobWorker(targetName);
if (jobWorker != null && jobWorker.inService()) {
throw new IllegalStateException("dataX worker is on duty");
}
this.setBizResult(context, new PluginDescMeta(DataXJobWorker.getDesc(targetName)));
}
Aggregations