Skip to content

Commit

Permalink
data cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
buildupchao committed Mar 1, 2020
1 parent 13bd2d6 commit c5edc28
Show file tree
Hide file tree
Showing 7 changed files with 206 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<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">
<parent>
<artifactId>pattern-distribution-component</artifactId>
<groupId>com.buildupchao</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.buildupchao</groupId>
<artifactId>pattern-distribution-component-sentinel</artifactId>
<version>0.0.1-SNAPSHOT</version>

<dependencies>
<dependency>
<groupId>com.alibaba.csp</groupId>
<artifactId>sentinel-core</artifactId>
<version>1.4.0</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package com.pattern.distribution.component.sentinel;

/**
* @author buildupchao
* @date 2019/12/29 10:45
* @since JDK 1.8
*/
public class SentinelApp {
}
1 change: 1 addition & 0 deletions pattern-distribution-component/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<module>pattern-distribution-component-zk</module>
<module>pattern-distribution-component-jta</module>
<module>pattern-distribution-component-mq</module>
<module>pattern-distribution-component-sentinel</module>
</modules>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package com.pattern.tutor.syntax.database.util;

import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;

@Slf4j
public class FilterUselessTaskInfo {

private volatile LinkedHashSet<String> data = new LinkedHashSet<>();
private static final String OUTPUT = "/src/main/resources/database/ids_result";

public static void main(String[] args) throws Exception {
String base = System.getProperty("user.dir") + "/pattern-tutor/pattern-tutor-syntax";
List<String> filter = Files.readAllLines(Paths.get(base, "/src/main/resources/database/ids2"));
HashSet<String> filterValues = Sets.newHashSet(filter);
List<String> originDatas = Files.readAllLines(Paths.get(base, "/src/main/resources/database/ids1"));

FileOutputStream out = new FileOutputStream(new File(base + OUTPUT));
originDatas.stream().map(v -> {
String taskIdStr = v.split("_")[3];
System.out.println(taskIdStr + " -> " + filterValues.contains(taskIdStr));
if (!filterValues.contains(taskIdStr)) {
return "delete /escheduler/tasks_queue/" + v;
}
return null;
}).filter(StringUtils::isNotBlank)
.forEach(v -> {
try {
out.write((v + "\n").getBytes());
} catch (IOException e) {
e.printStackTrace();
}
});
System.out.println("DONE______________________");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
2_325709_2_653456_169022094
2_325655_2_653322_169022094
2_325757_2_653642_169022094
2_325658_2_653332_169022094
2_325661_2_653344_169022094
2_325867_2_653882_169023497
2_325689_2_653419_169022094
2_325689_2_653420_169022094
2_325655_2_653323_169022094
2_325864_2_653879_169023497
2_325627_2_653222_169022094
2_325735_2_653546_169022094
2_325872_2_653887_169022094
2_325757_2_653641_169022094
2_325869_2_653884_169022094
2_325730_2_653533_169022094
2_325868_2_653883_169022094
2_325660_2_653341_169022094
2_325792_2_653781_169022094
2_325714_2_653467_169022094
2_325852_2_653867_-1
2_325870_2_653885_169023497
2_325658_2_653337_169022094
2_325751_2_653621_169022094
2_325655_2_653324_169022094
2_325653_2_653319_169022094
2_325688_2_653417_169022094
2_325658_2_653334_169022094
2_325695_2_653432_169022094
2_325658_2_653331_169022094
2_325730_2_653531_169022094
2_325677_2_653404_169022094
2_325757_2_653645_169022094
2_325658_2_653335_169022094
2_325655_2_653326_169022094
2_325863_2_653878_169023497
2_325660_2_653342_169022094
2_325757_2_653644_169022094
2_325655_2_653327_169022094
2_325670_2_653396_169022094
2_325659_2_653339_169022094
2_325726_2_653527_169022094
2_325866_2_653881_169023497
2_325729_2_653530_169022094
2_325702_2_653445_169022094
2_325658_2_653336_169022094
2_325697_2_653436_169022094
2_325663_2_653346_169022094
2_325837_2_653849_169022094
2_325658_2_653333_169022094
2_325801_2_653790_169022094
2_325757_2_653643_169022094
2_325641_2_653252_169022094
2_325837_2_653850_169022094
2_325730_2_653532_169022094
2_325658_2_653330_169022094
2_325659_2_653340_169022094
2_325743_2_653591_169022094
2_325655_2_653325_169022094
2_325658_2_653338_169022094
2_325865_2_653880_169023497
2_325742_2_653589_169022094
2_325871_2_653886_169023497
2_325650_2_653312_169022094
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
653319
653322
653323
653324
653325
653326
653327
653330
653331
653332
653333
653334
653335
653336
653337
653338
653339
653340
653341
653342
653344
653346
653396
653419
653420
653530
653531
653532
653533
653591
653621
653641
653642
653643
653644
653645
653781
653790
653849
653850
653878
653879
653880
653881
653882
653883
653884
653885
653886
653887
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
delete /escheduler/tasks_queue/2_325709_2_653456_169022094
delete /escheduler/tasks_queue/2_325627_2_653222_169022094
delete /escheduler/tasks_queue/2_325735_2_653546_169022094
delete /escheduler/tasks_queue/2_325714_2_653467_169022094
delete /escheduler/tasks_queue/2_325852_2_653867_-1
delete /escheduler/tasks_queue/2_325688_2_653417_169022094
delete /escheduler/tasks_queue/2_325695_2_653432_169022094
delete /escheduler/tasks_queue/2_325677_2_653404_169022094
delete /escheduler/tasks_queue/2_325726_2_653527_169022094
delete /escheduler/tasks_queue/2_325702_2_653445_169022094
delete /escheduler/tasks_queue/2_325697_2_653436_169022094
delete /escheduler/tasks_queue/2_325641_2_653252_169022094
delete /escheduler/tasks_queue/2_325742_2_653589_169022094
delete /escheduler/tasks_queue/2_325650_2_653312_169022094

0 comments on commit c5edc28

Please sign in to comment.