ibuenros opened a new pull request #2548: [GOBBLIN-677] - Allow early termination of Gobblin jobs based on a predicate on the job progress URL: https://github.com/apache/incubator-gobblin/pull/2548 Dear Gobblin maintainers, Please accept this PR. I understand that it will not be reviewed until I have checked off all the steps below! ### JIRA - [ ] My PR addresses the following [Gobblin JIRA](https://issues.apache.org/jira/browse/GOBBLIN/) issues and references them in the PR title. For example, "[GOBBLIN-XXX] My Gobblin PR" - https://issues.apache.org/jira/browse/GOBBLIN-677 ### Description - [ ] Here are some details about my PR, including screenshots (if applicable): This PR adds the possibility of terminating a job early once a predicate (based on the job progress is satisfied). There are four main changes: - `ReflectivePredicateEvaluator` is an evaluator for SQL queries which takes as an input a list of objects implementing a reference type. Each object is considered a row, and each public method in the reference type is a column. The evaluator runs the expression on the list of objects and expects a result with a single boolean column, which is then `AND`'d to obtain the result of the predicate. This is powered by Calcite, and can be used for expressive policies in a number of use cases. - `FiniteStateMachine` is a thread-safe finite state machine implementation that gates certain actions on the current state of the machine and whether a transition is legal. It is used, for example, to manage the state of the MR job launcher and make sure that interruptions and cancels work correctly regardless of whether the MR job is pending, running, or already finished. - Actual early termination logic. `JobInterruptionPredicate` used a `ReflectivePredicateEvaluator` with base type `JobProgress` to evaluate a predicate on the job progress every 30 seconds (for example, `SELECT elapsedTime > (30 * 60 * 1000) AND completedTasks >= totalTasks * 0.75 FROM jobProgress`). Once the predicate is satisfied, it calls a shutdown trigger specific to the current job launcher. - For `MRJobLauncher`, the early termination is driven via creating a specific file in the `mrJobDir`. The Gobblin mappers, once they find this file, indicate to the `Extractor` that they should terminate. If the `Extractor` understands this command, it is supposed to do a graceful early termination of extraction, committing watermarks, etc. If it does not recognize it, an exception is thrown triggering a task failure. An implementation for graceful early termination of `KafkaExtractor` is provided. ### Tests - [ ] My PR adds the following unit tests __OR__ does not need testing for this extremely good reason: There are a bunch of unit tests for the individual components. Additionally, tests where run on actual Gobblin executions. ### Commits - [ ] My commits all reference JIRA issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)": 1. Subject is separated from body by a blank line 2. Subject is limited to 50 characters 3. Subject does not end with a period 4. Subject uses the imperative mood ("add", not "adding") 5. Body wraps at 72 characters 6. Body explains "what" and "why", not "how"
---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
