Skip to content

Commit

Permalink
bak
Browse files Browse the repository at this point in the history
  • Loading branch information
peacewong committed Sep 4, 2023
1 parent 5a58d73 commit 42435c5
Show file tree
Hide file tree
Showing 104 changed files with 7,663 additions and 0 deletions.
128 changes: 128 additions & 0 deletions linkis-extensions/linkis-et-monitor/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright 2019 WeBank
~ Licensed 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.linkis</groupId>
<artifactId>linkis</artifactId>
<version>${revision}</version>
<relativePath>../../pom.xml</relativePath>
</parent>

<artifactId>linkis-et-monitor</artifactId>

<dependencies>
<dependency>
<groupId>org.apache.linkis</groupId>
<artifactId>linkis-httpclient</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.linkis</groupId>
<artifactId>linkis-mybatis</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.apache.linkis</groupId>
<artifactId>linkis-wedatasphere-common</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.apache.linkis</groupId>
<artifactId>linkis-module</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.apache.linkis</groupId>
<artifactId>linkis-gateway-httpclient-support</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.apache.linkis</groupId>
<artifactId>linkis-common</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.linkis</groupId>
<artifactId>linkis-computation-client</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.linkis</groupId>
<artifactId>linkis-bml-cleaner</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.linkis</groupId>
<artifactId>linkis-storage</artifactId>
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.linkis</groupId>
<artifactId>linkis-rpc</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<inherited>false</inherited>
<configuration>
<skipAssembly>false</skipAssembly>
<finalName>out</finalName>
<appendAssemblyId>false</appendAssemblyId>
<attach>false</attach>
<descriptors>
<descriptor>src/main/assembly/distribution.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<goals>
<goal>single</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
297 changes: 297 additions & 0 deletions linkis-extensions/linkis-et-monitor/src/main/assembly/distribution.xml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/*
* 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.linkis.monitor.scan.app;

import org.apache.linkis.monitor.scan.app.dirtydata.entrance.EntranceDirtyDataHandler;
import org.apache.linkis.monitor.scan.utils.log.LogUtils;
import org.apache.linkis.server.utils.LinkisMainHelper;

import org.apache.commons.lang3.StringUtils;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.AbstractApplicationContext;

import org.slf4j.Logger;

public class LinkisDirtyDataCleanApplication {
private static final Logger logger = LogUtils.stdOutLogger();

/** @param args: args[0]: host args[1] port */
public static void main(String[] args) throws ReflectiveOperationException {
if (args.length == 0
|| StringUtils.equalsIgnoreCase(args[0], "help")
|| StringUtils.equalsIgnoreCase(args[0], "--help")) {
LogUtils.stdOutLogger()
.info(
"[help-message]this app cleans entrance dirty-data. args[0]: command-type (entrance/help/...) args[1]: entrance-hostname(not null), args[2]: entrance-port(can be null)");
return;
}
String serviceName = System.getProperty(LinkisMainHelper.SERVER_NAME_KEY());
LinkisMainHelper.formatPropertyFiles(serviceName);

if (StringUtils.equalsIgnoreCase(args[0], "entrance")) {
AbstractApplicationContext context =
new AnnotationConfigApplicationContext(LinkisJobHistoryScanSpringConfiguration.class);

String host = "";
String port = "";
if (args.length > 1) {
host = args[1];
}
if (args.length > 2) {
port = args[2];
}
if (args.length > 3) {
printIllegalInput("wrong number of arguments");
return;
}
try {
removeDirtyEurekaInstance(host, port);
} catch (Exception e) {
LogUtils.stdOutLogger().error("Failed to remove dirty eureka-instance", e);
}
try {
removeDbDirtyData(host, port);
} catch (Exception e) {
LogUtils.stdOutLogger().error("Failed to remove dirty db-data", e);
}

context.close();
} else {
LogUtils.stdOutLogger().error("Upsupported command type: " + args[0]);
}
}

private static void printIllegalInput(String msg) {
LogUtils.stdOutLogger().error("illegal input: " + msg);
LogUtils.stdOutLogger()
.info(
"[help-message] this app cleans entrance dirty-data. args[0]: entrance-hostname, args[1]: entrance-port");
return;
}

private static void removeDirtyEurekaInstance(String host, String port) {
if (StringUtils.isBlank(host)) {
printIllegalInput("host cannot be blank");
return;
}
if (StringUtils.isBlank(port)) {
EntranceDirtyDataHandler.handleEurekaDirtyData(host);
} else {
EntranceDirtyDataHandler.handleEurekaDirtyData(host, port);
}
}

private static void removeDbDirtyData(String host, String port) {
if (StringUtils.isBlank(host)) {
printIllegalInput("host cannot be blank");
return;
}
if (StringUtils.isBlank(port)) {
EntranceDirtyDataHandler.handleDbDirtData(host);
} else {
EntranceDirtyDataHandler.handleDbDirtData(host, port);
}
}
}
Loading

0 comments on commit 42435c5

Please sign in to comment.