forked from voldemort/voldemort
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for custom hooks in the VoldemortBuildAndPushJob. Heart…
…beat hooks run in a daemon thread.
- Loading branch information
Showing
5 changed files
with
263 additions
and
157 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
...b/hadoop-store-builder/src/java/voldemort/store/readonly/mr/azkaban/BuildAndPushHook.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package voldemort.store.readonly.mr.azkaban; | ||
|
||
import java.util.Properties; | ||
|
||
/** | ||
* This can be implemented in order to act on certain stages of the Build and Push job. | ||
* | ||
* Implementations of this interface must have a no-arguments constructor. | ||
* | ||
* All hooks registered via the job's config will be instantiated by reflection, and | ||
* then provided the job's properties via the {@link #init(java.util.Properties)} | ||
* function. Afterward, the {@link #invoke(BuildAndPushStatus, String)} function will | ||
* be called at various stages of the job, within a try/catch (i.e.: the hooks are | ||
* executed on a best effort basis and are not meant to be allowed to fail the job). | ||
*/ | ||
public interface BuildAndPushHook { | ||
/** | ||
* A hook name, for logging purposes. | ||
* | ||
* @return a human-readable name for the hook. | ||
*/ | ||
String getName(); | ||
|
||
/** | ||
* Hooks can inspect the job's regular config params as well as look for config params | ||
* that they need for their own operation. It is strongly recommended to name-space | ||
* config params that are hook-specific, in order to avoid name-clashes, according to | ||
* the following convention: "hooks." followed by the hook's FQCN, followed by a config | ||
* name, for example: | ||
* | ||
* hooks.com.company.fully.qualified.class.name.of.TheHook.some-config-name=some-config-value | ||
* | ||
* If this function throws an exception, its {@link #invoke(BuildAndPushStatus, String)} | ||
* function will not be called during the job. | ||
* | ||
* @param properties of the Build and Push job. | ||
*/ | ||
void init(Properties properties) throws Exception; | ||
|
||
/** | ||
* This is called by the Build and Push job at various stages during the life-cycle of the job. | ||
* | ||
* It is called within a try/catch and will not allow the job to fail even if it throws. | ||
* | ||
* @param status an instance of the BuildAndPushStatus enum | ||
* @param details Can be null. Not all stages have details associated with them. | ||
*/ | ||
void invoke(BuildAndPushStatus status, String details); | ||
} |
16 changes: 16 additions & 0 deletions
16
...hadoop-store-builder/src/java/voldemort/store/readonly/mr/azkaban/BuildAndPushStatus.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package voldemort.store.readonly.mr.azkaban; | ||
|
||
/** | ||
* This enum describes the various stages a Build and Push can be in. | ||
*/ | ||
public enum BuildAndPushStatus { | ||
// The "happy path" status: | ||
STARTING, | ||
BUILDING, | ||
PUSHING, | ||
FINISHED, | ||
HEARTBEAT, // N.B.: The heartbeat is emitted periodically during any of the stages... | ||
// The "not-so-happy path" status: | ||
CANCELLED, | ||
FAILED; | ||
} |
75 changes: 0 additions & 75 deletions
75
contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/azkaban/Job.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.