Search in sources :

Example 1 with TargetResName

use of com.qlangtech.tis.coredefine.module.action.TargetResName in project plugins by qlangtech.

the class TISFlinkCDCStart method main.

public static void main(String[] args) throws Exception {
    if (args.length != 1) {
        throw new IllegalArgumentException("args length must be 1,now is:" + args.length);
    }
    String dataxName = args[0];
    // -classpath /Users/mozhenghua/j2ee_solution/project/plugins/tis-incr/tis-flink-dependency/target/tis-flink-dependency/WEB-INF/lib/*:/Users/mozhenghua/j2ee_solution/project/plugins/tis-incr/tis-flink-cdc-plugin/target/tis-flink-cdc-plugin/WEB-INF/lib/*:/Users/mozhenghua/j2ee_solution/project/plugins/tis-incr/tis-elasticsearch7-sink-plugin/target/tis-elasticsearch7-sink-plugin/WEB-INF/lib/*:/Users/mozhenghua/j2ee_solution/project/plugins/tis-incr/tis-realtime-flink/target/tis-realtime-flink/WEB-INF/lib/*:/Users/mozhenghua/j2ee_solution/project/plugins/tis-incr/tis-realtime-flink-launch/target/tis-realtime-flink-launch.jar:/Users/mozhenghua/j2ee_solution/project/plugins/tis-incr/tis-realtime-flink-launch/target/dependency/*:/Users/mozhenghua/j2ee_solution/project/plugins/tis-datax/tis-datax-elasticsearch-plugin/target/tis-datax-elasticsearch-plugin/WEB-INF/lib/*:
    // CenterResource.setNotFetchFromCenterRepository();
    // Thread.currentThread().setContextClassLoader(TIS.get().pluginManager.uberClassLoader);
    // IPluginContext pluginContext = IPluginContext.namedContext(dataxName);
    // 
    // 
    // List<IncrStreamFactory> streamFactories = HeteroEnum.INCR_STREAM_CONFIG.getPlugins(pluginContext, null);
    // IRCController incrController = null;
    // for (IncrStreamFactory factory : streamFactories) {
    // incrController = factory.getIncrSync();
    // }
    // Objects.requireNonNull(incrController, "stream app:" + dataxName + " incrController can not not be null");
    IncrStreamFactory incrStreamFactory = HeteroEnum.getIncrStreamFactory(dataxName);
    BasicFlinkSourceHandle tableStreamHandle = createFlinkSourceHandle(dataxName);
    tableStreamHandle.setStreamFactory(incrStreamFactory);
    deploy(new TargetResName(dataxName), tableStreamHandle, null, -1);
}
Also used : TargetResName(com.qlangtech.tis.coredefine.module.action.TargetResName) BasicFlinkSourceHandle(com.qlangtech.tis.realtime.BasicFlinkSourceHandle) IncrStreamFactory(com.qlangtech.tis.plugin.incr.IncrStreamFactory)

Example 2 with TargetResName

use of com.qlangtech.tis.coredefine.module.action.TargetResName in project plugins by qlangtech.

the class FlinkK8SClusterManager method listPodAndWatchLog.

@Override
public WatchPodLog listPodAndWatchLog(String podName, ILogListener listener) {
    K8sImage k8sImage = this.getK8SImage();
    ApiClient apiClient = k8sImage.createApiClient();
    return K8SController.listPodAndWatchLog(apiClient, k8sImage, "flink-main-container", new TargetResName(this.clusterId), podName, listener);
}
Also used : TargetResName(com.qlangtech.tis.coredefine.module.action.TargetResName) ApiClient(io.kubernetes.client.openapi.ApiClient) K8sImage(com.qlangtech.tis.plugin.k8s.K8sImage)

Example 3 with TargetResName

use of com.qlangtech.tis.coredefine.module.action.TargetResName in project plugins by qlangtech.

the class FlinkK8SClusterManager method getRCDeployment.

@Override
public RcDeployment getRCDeployment() {
    RcDeployment deployment = new RcDeployment();
    K8sImage k8sImage = this.getK8SImage();
    ApiClient apiClient = k8sImage.createApiClient();
    AppsV1Api appsApi = new AppsV1Api(apiClient);
    CoreV1Api coreApi = new CoreV1Api(apiClient);
    // String name, String namespace, String pretty, Boolean exact, Boolean export
    try {
        V1Deployment deploy = appsApi.readNamespacedDeployment(this.clusterId, k8sImage.getNamespace(), "true", null, null);
        K8SController.fillSpecInfo(deployment, deploy.getSpec().getReplicas(), deploy.getSpec().getTemplate());
        V1DeploymentStatus status = deploy.getStatus();
        RcDeployment.ReplicationControllerStatus deploymentStatus = new RcDeployment.ReplicationControllerStatus();
        deploymentStatus.setAvailableReplicas(status.getAvailableReplicas());
        deploymentStatus.setFullyLabeledReplicas(0);
        deploymentStatus.setObservedGeneration(status.getObservedGeneration());
        deploymentStatus.setReadyReplicas(status.getReadyReplicas());
        deploymentStatus.setReplicas(status.getReplicas());
        deployment.setStatus(deploymentStatus);
        K8SController.fillCreateTimestamp(deployment, deploy.getMetadata());
        K8SController.fillPods(coreApi, k8sImage, deployment, new TargetResName(this.clusterId));
    } catch (ApiException e) {
        throw K8sExceptionUtils.convert(this.clusterId, e);
    }
    return deployment;
}
Also used : V1Deployment(io.kubernetes.client.openapi.models.V1Deployment) TargetResName(com.qlangtech.tis.coredefine.module.action.TargetResName) RcDeployment(com.qlangtech.tis.coredefine.module.action.impl.RcDeployment) AppsV1Api(io.kubernetes.client.openapi.apis.AppsV1Api) ApiClient(io.kubernetes.client.openapi.ApiClient) V1DeploymentStatus(io.kubernetes.client.openapi.models.V1DeploymentStatus) CoreV1Api(io.kubernetes.client.openapi.apis.CoreV1Api) K8sImage(com.qlangtech.tis.plugin.k8s.K8sImage) ApiException(io.kubernetes.client.openapi.ApiException)

Example 4 with TargetResName

use of com.qlangtech.tis.coredefine.module.action.TargetResName in project plugins by qlangtech.

the class TestK8sIncrSync method testGetRCDeployment.

public void testGetRCDeployment() {
    IRCController incrSync = TestDefaultIncrK8sConfig.getIncrSync();
    IDeploymentDetail rcDeployment = incrSync.getRCDeployment(new TargetResName(TestDefaultIncrK8sConfig.totalpay));
    assertNotNull(rcDeployment);
}
Also used : TargetResName(com.qlangtech.tis.coredefine.module.action.TargetResName) IRCController(com.qlangtech.tis.coredefine.module.action.IRCController) IDeploymentDetail(com.qlangtech.tis.coredefine.module.action.IDeploymentDetail)

Example 5 with TargetResName

use of com.qlangtech.tis.coredefine.module.action.TargetResName in project plugins by qlangtech.

the class TestDefaultIncrK8sConfig method testCreateIncrDeployment.

public void testCreateIncrDeployment() throws Exception {
    IRCController incr = incrFactory.getIncrSync();
    assertNotNull(incr);
    assertFalse(s4totalpay + " shall have not deploy incr instance in k8s", incr.getRCDeployment(new TargetResName(s4totalpay)) != null);
    RcDeployment incrSpec = new RcDeployment();
    incrSpec.setCpuLimit(Specification.parse("1"));
    incrSpec.setCpuRequest(Specification.parse("500m"));
    incrSpec.setMemoryLimit(Specification.parse("1G"));
    incrSpec.setMemoryRequest(Specification.parse("500M"));
    incrSpec.setReplicaCount(1);
    long timestamp = 20190820171040l;
    try {
        incr.deploy(new TargetResName(s4totalpay), incrSpec, timestamp);
    } catch (Exception e) {
        throw e;
    }
}
Also used : TargetResName(com.qlangtech.tis.coredefine.module.action.TargetResName) RcDeployment(com.qlangtech.tis.coredefine.module.action.impl.RcDeployment) IRCController(com.qlangtech.tis.coredefine.module.action.IRCController)

Aggregations

TargetResName (com.qlangtech.tis.coredefine.module.action.TargetResName)19 CUDCDCTestSuit (com.qlangtech.plugins.incr.flink.cdc.CUDCDCTestSuit)5 IRCController (com.qlangtech.tis.coredefine.module.action.IRCController)5 ISelectedTab (com.qlangtech.tis.plugin.ds.ISelectedTab)5 Collectors (java.util.stream.Collectors)5 IMQListener (com.qlangtech.tis.async.message.client.consumer.IMQListener)4 MQConsumeException (com.qlangtech.tis.async.message.client.consumer.MQConsumeException)4 IDataxProcessor (com.qlangtech.tis.datax.IDataxProcessor)4 BasicDataXRdbmsReader (com.qlangtech.tis.plugin.datax.common.BasicDataXRdbmsReader)4 BasicDataSourceFactory (com.qlangtech.tis.plugin.ds.BasicDataSourceFactory)4 List (java.util.List)4 JobExecutionResult (org.apache.flink.api.common.JobExecutionResult)4 SourceChannel (com.qlangtech.plugins.incr.flink.cdc.SourceChannel)3 TISDeserializationSchema (com.qlangtech.plugins.incr.flink.cdc.TISDeserializationSchema)3 IAsyncMsgDeserialize (com.qlangtech.tis.async.message.client.consumer.IAsyncMsgDeserialize)3 IConsumerHandle (com.qlangtech.tis.async.message.client.consumer.IConsumerHandle)3 IDataxReader (com.qlangtech.tis.datax.IDataxReader)3 ReaderSource (com.qlangtech.tis.realtime.ReaderSource)3 DTO (com.qlangtech.tis.realtime.transfer.DTO)3 Test (org.junit.Test)3