-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add FilePredicates for jobs #17525
Add FilePredicates for jobs #17525
Conversation
7b2b659
to
17740e5
Compare
bf92dae
to
0d02bf7
Compare
02afc2b
to
873f1ab
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly LGTM, some style comments, thanks for the contribution! The PR looks a lot better this time, keep up the good work!
return predicate; | ||
} | ||
} | ||
return new NoPredicate(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel like the default semantic should be if no filter then all files should pass instead of no files pass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jja725 I think we should block the move job, because think about if user puts in an invalid filter, if we move all the files from source to destination. User would be frustrated to put everything back.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case If they put a unknown filter, we should throw an exception then. And if they didn't put filter, we should have all things passed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gotcha
Iterable<FileInfo> fileIterator = | ||
new UfsFileIterable(ufs, mJobEntry.getSrc(), user, mJobEntry.getPartialListing(), | ||
FileInfo::isCompleted); | ||
filePredicate.get()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you think we can combine create & get into one function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could, but I think it would be more flexible if we have separate functions.
dora/core/server/master/src/main/java/alluxio/master/job/MoveJob.java
Outdated
Show resolved
Hide resolved
dora/core/server/master/src/test/java/alluxio/master/predicate/TimePredicateTest.java
Outdated
Show resolved
Hide resolved
dora/core/server/master/src/test/java/alluxio/master/predicate/TimePredicateTest.java
Outdated
Show resolved
Hide resolved
@@ -116,7 +119,8 @@ public void testProgressReport() throws Exception { | |||
FileIterable files = | |||
new FileIterable(fileSystemMaster, srcPath, user, false, MoveJob.QUALIFIED_FILE_FILTER); | |||
MoveJob job = spy(new MoveJob(srcPath, dstPath, false, user, "1", | |||
OptionalLong.empty(), false, false, false, files)); | |||
OptionalLong.empty(), false, false, false, files, | |||
FileFilter.getDefaultInstance())); | |||
when(job.getDurationInSec()).thenReturn(0L); | |||
job.setJobState(JobState.RUNNING, false); | |||
List<Route> nextRoutes = job.getNextRoutes(25); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you mind adding some tests for the move job with predicate? To make sure we filter the current files. Also it's nice to cover what happened if we have an exception when findTimestampFromFileName
55dab17
to
336c503
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there, leave one comment
dora/core/server/master/src/main/java/alluxio/master/predicate/FilePredicate.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
dora/core/server/master/src/main/java/alluxio/master/predicate/FilePredicate.java
Outdated
Show resolved
Hide resolved
alluxio-bot, merge this please |
What changes are proposed in this pull request?
Adding the predicates for move jobs in order to be triggered by the policy engine.
Why are the changes needed?
Adding two predicates:
Does this PR introduce any user facing changes?
NA