Commit 87cb33b2 authored by Yeleights's avatar Yeleights
Browse files

deal with conflict

parents 77023aee c1ee1333
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -20,7 +20,9 @@ package org.apache.dolphinscheduler.alert.utils;
 * constants
 */
public class Constants {

    private Constants() {
        throw new IllegalStateException("Constants class");
    }
    /**
     * alert properties path
     */
+4 −10
Original line number Diff line number Diff line
@@ -31,12 +31,6 @@
    <dependency>
      <groupId>org.apache.dolphinscheduler</groupId>
      <artifactId>dolphinscheduler-alert</artifactId>
      <exclusions>
        <exclusion>
          <groupId>org.apache.dolphinscheduler</groupId>
          <artifactId>dolphinscheduler-dao</artifactId>
        </exclusion>
      </exclusions>
    </dependency>

    <dependency>
@@ -129,13 +123,13 @@
    </dependency>

    <dependency>
      <groupId>com.github.xiaoymin</groupId>
      <artifactId>swagger-bootstrap-ui</artifactId>
      <groupId>org.apache.dolphinscheduler</groupId>
      <artifactId>dolphinscheduler-service</artifactId>
    </dependency>

    <dependency>
      <groupId>org.apache.dolphinscheduler</groupId>
      <artifactId>dolphinscheduler-rpc</artifactId>
      <groupId>com.github.xiaoymin</groupId>
      <artifactId>swagger-bootstrap-ui</artifactId>
    </dependency>

    <dependency>
+2 −2
Original line number Diff line number Diff line
@@ -22,12 +22,12 @@ import org.apache.dolphinscheduler.api.utils.Result;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.ExecutionStatus;
import org.apache.dolphinscheduler.common.enums.Flag;
import org.apache.dolphinscheduler.common.queue.ITaskQueue;
import org.apache.dolphinscheduler.common.queue.TaskQueueFactory;
import org.apache.dolphinscheduler.common.utils.ParameterUtils;
import org.apache.dolphinscheduler.common.utils.StringUtils;
import org.apache.dolphinscheduler.dao.entity.User;
import io.swagger.annotations.*;
import org.apache.dolphinscheduler.service.queue.ITaskQueue;
import org.apache.dolphinscheduler.service.queue.TaskQueueFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
+0 −137
Original line number Diff line number Diff line
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.dolphinscheduler.api.log;

import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import io.grpc.StatusRuntimeException;
import org.apache.dolphinscheduler.rpc.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.TimeUnit;

/**
 * log client
 */
public class LogClient {

    private static final Logger logger = LoggerFactory.getLogger(LogClient.class);

    private final ManagedChannel channel;
    private final LogViewServiceGrpc.LogViewServiceBlockingStub blockingStub;

    /**
     * construct client connecting to HelloWorld server at {@code host:port}
     *
     * @param host host
     * @param port port
     */
    public LogClient(String host, int port) {
        this(ManagedChannelBuilder.forAddress(host, port)
                // Channels are secure by default (via SSL/TLS). For the example we disable TLS to avoid
                // needing certificates.
                .usePlaintext(true));
    }

    /**
     * construct client for accessing RouteGuide server using the existing channel
     *
     */
    LogClient(ManagedChannelBuilder<?> channelBuilder) {
        /**
         * set max read size
         */
        channelBuilder.maxInboundMessageSize(Integer.MAX_VALUE);
        channel = channelBuilder.build();
        blockingStub = LogViewServiceGrpc.newBlockingStub(channel);
    }

    /**
     * shutdown
     *
     * @throws InterruptedException InterruptedException
     */
    public void shutdown() throws InterruptedException {
        channel.shutdown().awaitTermination(5, TimeUnit.SECONDS);
    }

    /**
     * roll view log
     *
     * @param path path
     * @param skipLineNum skip line number
     * @param limit limit
     * @return log content
     */
    public String rollViewLog(String path,int skipLineNum,int limit) {
        logger.info("roll view log : path {},skipLineNum {} ,limit {}", path, skipLineNum, limit);
        LogParameter pathParameter = LogParameter
                .newBuilder()
                .setPath(path)
                .setSkipLineNum(skipLineNum)
                .setLimit(limit)
                .build();
        RetStrInfo retStrInfo;
        try {
            retStrInfo = blockingStub.rollViewLog(pathParameter);
            return retStrInfo.getMsg();
        } catch (StatusRuntimeException e) {
            logger.error("roll view log error", e);
            return null;
        }
    }

    /**
     * view log
     *
     * @param path path
     * @return log content
     */
    public String viewLog(String path) {
        logger.info("view log path {}",path);
        PathParameter pathParameter = PathParameter.newBuilder().setPath(path).build();
        RetStrInfo retStrInfo;
        try {
            retStrInfo = blockingStub.viewLog(pathParameter);
            return retStrInfo.getMsg();
        } catch (StatusRuntimeException e) {
            logger.error("view log error", e);
            return null;
        }
    }

    /**
     * get log size
     *
     * @param path log path
     * @return log content bytes
     */
    public byte[] getLogBytes(String path) {
        logger.info("log path {}",path);
        PathParameter pathParameter = PathParameter.newBuilder().setPath(path).build();
        RetByteInfo retByteInfo;
        try {
            retByteInfo = blockingStub.getLogBytes(pathParameter);
            return retByteInfo.getData().toByteArray();
        } catch (StatusRuntimeException e) {
            logger.error("log size error", e);
            return null;
        }
    }

}
 No newline at end of file
+5 −5
Original line number Diff line number Diff line
@@ -24,13 +24,13 @@ import org.apache.dolphinscheduler.api.enums.Status;
import org.apache.dolphinscheduler.common.Constants;
import org.apache.dolphinscheduler.common.enums.CommandType;
import org.apache.dolphinscheduler.common.enums.UserType;
import org.apache.dolphinscheduler.common.queue.ITaskQueue;
import org.apache.dolphinscheduler.common.queue.TaskQueueFactory;
import org.apache.dolphinscheduler.common.utils.DateUtils;
import org.apache.dolphinscheduler.common.utils.StringUtils;
import org.apache.dolphinscheduler.dao.ProcessDao;
import org.apache.dolphinscheduler.dao.entity.*;
import org.apache.dolphinscheduler.dao.mapper.*;
import org.apache.dolphinscheduler.service.process.ProcessService;
import org.apache.dolphinscheduler.service.queue.ITaskQueue;
import org.apache.dolphinscheduler.service.queue.TaskQueueFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -69,7 +69,7 @@ public class DataAnalysisService extends BaseService{
    TaskInstanceMapper taskInstanceMapper;

    @Autowired
    ProcessDao processDao;
    ProcessService processService;

    /**
     * statistical task instance status data
@@ -296,7 +296,7 @@ public class DataAnalysisService extends BaseService{
        if(projectId !=0){
            projectIds.add(projectId);
        }else if(loginUser.getUserType() == UserType.GENERAL_USER){
            projectIds = processDao.getProjectIdListHavePerm(loginUser.getId());
            projectIds = processService.getProjectIdListHavePerm(loginUser.getId());
            if(projectIds.size() ==0 ){
                projectIds.add(0);
            }
Loading