Search in sources :

Example 6 with DataXJobWorker

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执行器");
}
Also used : DataXJobWorker(com.qlangtech.tis.datax.job.DataXJobWorker) AjaxValve(com.qlangtech.tis.manage.common.valve.AjaxValve) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 7 with DataXJobWorker

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);
}
Also used : JSONObject(com.alibaba.fastjson.JSONObject) DataXJobWorker(com.qlangtech.tis.datax.job.DataXJobWorker) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 8 with DataXJobWorker

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());
}
Also used : DataXJobWorker(com.qlangtech.tis.datax.job.DataXJobWorker) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 9 with DataXJobWorker

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 已经被删除");
}
Also used : DataXJobWorker(com.qlangtech.tis.datax.job.DataXJobWorker) Func(com.qlangtech.tis.manage.spring.aop.Func)

Example 10 with DataXJobWorker

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)));
}
Also used : DataXJobWorker(com.qlangtech.tis.datax.job.DataXJobWorker) Func(com.qlangtech.tis.manage.spring.aop.Func)

Aggregations

DataXJobWorker (com.qlangtech.tis.datax.job.DataXJobWorker)10 Func (com.qlangtech.tis.manage.spring.aop.Func)6 JSONObject (com.alibaba.fastjson.JSONObject)1 DataXJobSubmit (com.qlangtech.tis.datax.DataXJobSubmit)1 DataxProcessor (com.qlangtech.tis.datax.impl.DataxProcessor)1 IRemoteTaskTrigger (com.qlangtech.tis.fullbuild.indexbuild.IRemoteTaskTrigger)1 AjaxValve (com.qlangtech.tis.manage.common.valve.AjaxValve)1 IJoinTaskContext (com.qlangtech.tis.order.center.IJoinTaskContext)1 ITISRpcService (com.tis.hadoop.rpc.ITISRpcService)1 RpcServiceReference (com.tis.hadoop.rpc.RpcServiceReference)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1