[ https://issues.apache.org/jira/browse/GRIFFIN-200?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16656370#comment-16656370 ]
Lionel Liu commented on GRIFFIN-200: ------------------------------------ I've finished all your discussion here, which is really a long thread. I like the idea of griffin job lifecycle hook mechanism, it will help if users need some extra processes before or after griffin job create/start/pause/stop/delete action. Synchronous semantics seems better in hook processes in lifecycles, e.g.: if I add a hook before griffin job starts, I expect the job starts exactly after the hook process ends. Maybe we can use synchronous semantics by default, and users could also use it in asynchronous way by another parameter or another function or something like that. On the other hand, I think we can also leverage the similar mechanism for job instance lifecycle, some potential use cases might be: - before each job instance starts, the data source files or some mark files could be checked if existed, to enable the job - before each job instance starts, the data source file needs to be moved to the specific place first. - after job instance ends, the data source files are required to be removed. - after job instance ends, the result files (like missing records in accuracy measure) needs to be the data source file of another job instance, the hook there could help to trigger the next job. Maybe the examples are not appropriate, but I believe that some of them are useful. Actually, as the first example to check some mark files before job instance starts, it's implemented in griffin service at current, in an inappropriate way. It's a good chance to bring it to the right way here. > Lifecycle hooks support > ----------------------- > > Key: GRIFFIN-200 > URL: https://issues.apache.org/jira/browse/GRIFFIN-200 > Project: Griffin (Incubating) > Issue Type: New Feature > Reporter: Nikolay Sokolov > Assignee: William Guo > Priority: Minor > > In some environments, users might want to perform certain actions > before/after job is created, before/after job is activated, before/after job > is deleted, and so on. > To fullfill that need, some hook plugin mechanism can be provided, similar to > what Hive is doing. User would place respective jar files into Service module > classpath at deployment time, and would specify class names using some > annotation or using property listing class names (particular mechanism is yet > to be determined). > Proposed signature: > {code:none} > public interface JobLifecycleHook { > void onJobEvent(JobLifecycleEvent event) throws Exception; > } > public class BeforeJobCreated implements JobLifecycleEvent { ... } > public class AfterJobCreated implements JobLifecycleEvent { ... } > public class BeforeJobDeleted implements JobLifecycleEvent { ... } > public class AfterJobDeleted implements JobLifecycleEvent { ... } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)