Skip to content

Commit

Permalink
path에 대한 prepare statement 처리 (#15), state 옵션 추가 (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
HeoKyungseok committed Oct 17, 2022
1 parent b49a875 commit 4c13194
Show file tree
Hide file tree
Showing 6 changed files with 1,357 additions and 131 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,17 @@ Rerun
performed JOB information
-source=source.conf source configuration file path
-target=target.conf target configuration file path
-thread= thread count
-thread= thread count
Check
-check check source and target configuration
-t=file|s3|swift source type, FILE(NAS) or S3 or SWIFT
-source=source.conf source configuration file path
-target=target.conf target configuration file path
Status Job
-status show job progress
-status show all jobs progress
-jobId=jobid show job progress for jobid
-srcbucket=bucket show job progress for srcbucket
-dstbucket=bucket show job progress for dstbucket
source.conf
mountpoint information mounted on the server to be performed
mountpoint=/ means move all files
Expand Down Expand Up @@ -108,7 +111,11 @@ ifs_mover -rerun=1 -source=source.conf -target=target.conf -thread=4
### 전체 이관 작업의 상태정보 조회
```sh
ifs_mover -status
ifs_mover -status // 모든 Job에 대한 작업 상태 정보 조회
ifs_mover -status -jobid=3 // jobId = 3인 Job에 대한 작업 상태 정보 조회
ifs_mover -status -srcbucket=bucket-1 // source bucket 이름에 "bucket-1" 포함된 Job에 대한 작업 상태 정보 조회
ifs_mover -status -dstbucket=bucket-1 // target bucket 이름에 "bucket-1" 포함된 Job에 대한 작업 상태 정보 조회
ifs_mover -status -srcbucket=bucket-1 -dstbucket=bucket-2 // source bucket 이름에 "bucket-1" 포함되고, target bucket 이름에 "bucket-2"가 포함된 Job에 대한 작업 상태 정보 조회
```
Expand Down
44 changes: 43 additions & 1 deletion src/main/java/ifs_mover/IMOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ public enum WORK_TYPE {
private boolean isRemoveId;
private boolean isRerunId;
private boolean isStatus;
private boolean isJobId;
private boolean isSrcBucketName;
private boolean isDstBucketName;

private String type;
private String sourceConfPath;
Expand All @@ -53,6 +56,9 @@ public enum WORK_TYPE {
private String removeId;
private String rerunId;
private int threadCount;
private String jobId;
private String srcBucketName;
private String dstBucketName;

private final String FILE = "file";
private final String S3 = "s3";
Expand Down Expand Up @@ -123,6 +129,9 @@ private void makeOptions() {
Option rerun = Option.builder(null).longOpt("rerun").hasArg(true).required(false).build();
Option check = Option.builder(null).longOpt("check").hasArg(false).required(false).build();
Option status = Option.builder(null).longOpt("status").hasArg(false).required(false).build();
Option jobid = Option.builder(null).longOpt("jobid").hasArg(true).required(false).build();
Option srcbucket = Option.builder(null).longOpt("srcbucket").hasArg(true).required(false).build();
Option dstbucket = Option.builder(null).longOpt("dstbucket").hasArg(true).required(false).build();

options.addOption(help);
options.addOption(type);
Expand All @@ -135,6 +144,9 @@ private void makeOptions() {
options.addOption(rerun);
options.addOption(check);
options.addOption(status);
options.addOption(jobid);
options.addOption(srcbucket);
options.addOption(dstbucket);
}

private void parseOptions() {
Expand Down Expand Up @@ -243,6 +255,21 @@ private void parseOptions() {
} else {
printUsage();
}

isJobId = line.hasOption("jobid");
if (isJobId) {
jobId = line.getOptionValue("jobid");
}

isSrcBucketName = line.hasOption("srcbucket");
if (isSrcBucketName) {
srcBucketName = line.getOptionValue("srcbucket");
}

isDstBucketName = line.hasOption("dstbucket");
if (isDstBucketName) {
dstBucketName = line.getOptionValue("dstbucket");
}
}

private void printUsage() {
Expand Down Expand Up @@ -281,7 +308,10 @@ private void printUsage() {
System.out.println("\t" + String.format("%-20s\t%s", "-target=target.conf", "target configuration file path"));

System.out.println("Status Job");
System.out.println("\t" + String.format("%-20s\t%s", "-status", "show job progress"));
System.out.println("\t" + String.format("%-20s\t%s", "-status", "show all jobs progress"));
System.out.println("\t" + String.format("%-20s\t%s", "-jobid=jobid", "show job progress for jobid"));
System.out.println("\t" + String.format("%-20s\t%s", "-srcbucket=bucket", "show job progress for srcbucket"));
System.out.println("\t" + String.format("%-20s\t%s", "-dstbucket=bucket", "show job progress for dstbucket"));

System.out.println("source.conf");
System.out.println("\t" + String.format("%-20s\t%s", "mountpoint", "information mounted on the server to be performed"));
Expand Down Expand Up @@ -466,4 +496,16 @@ public String getRerunId() {
public String getSourceConfPath() {
return sourceConfPath;
}

public String getJobId() {
return jobId;
}

public String getSrcBucketName() {
return srcBucketName;
}

public String getDstBucketName() {
return dstBucketName;
}
}
Loading

0 comments on commit 4c13194

Please sign in to comment.