forked from linkedin/dr-elephant
-
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.
LIHADOOP-16126: Easy integration of new schedulers to Dr. Elephant
RB=676088 G=superfriends-reviewers R=annag,fli,shanm,viramach A=annag,shanm
- Loading branch information
Showing
10 changed files
with
572 additions
and
118 deletions.
There are no files selected for viewing
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
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
131 changes: 131 additions & 0 deletions
131
app/com/linkedin/drelephant/schedulers/AzkabanScheduler.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,131 @@ | ||
/* | ||
* Copyright 2016 LinkedIn Corp. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
package com.linkedin.drelephant.schedulers; | ||
|
||
import com.linkedin.drelephant.util.Utils; | ||
import java.util.Properties; | ||
import org.apache.log4j.Logger; | ||
|
||
|
||
/** | ||
* This class provides methods to load information specific to the Azkaban scheduler. | ||
*/ | ||
public class AzkabanScheduler implements Scheduler { | ||
|
||
private static final Logger logger = Logger.getLogger(AzkabanScheduler.class); | ||
|
||
public static final String SCHEDULER_NAME = "azkaban"; | ||
public static final String AZKABAN_WORKFLOW_URL = "azkaban.link.workflow.url"; | ||
public static final String AZKABAN_JOB_URL = "azkaban.link.job.url"; | ||
public static final String AZKABAN_EXECUTION_URL = "azkaban.link.execution.url"; | ||
public static final String AZKABAN_ATTEMPT_URL = "azkaban.link.attempt.url"; | ||
public static final String AZKABAN_JOB_NAME = "azkaban.job.id"; | ||
|
||
private String jobDefId; | ||
private String jobExecId; | ||
private String flowDefId; | ||
private String flowExecId; | ||
|
||
private String jobDefUrl; | ||
private String jobExecUrl; | ||
private String flowDefUrl; | ||
private String flowExecUrl; | ||
|
||
private String jobName; | ||
private int workflowDepth; | ||
|
||
|
||
public AzkabanScheduler(String appId, Properties properties) { | ||
if (properties != null) { | ||
loadInfo(appId, properties); | ||
} else { | ||
// Use default value of data type | ||
} | ||
} | ||
|
||
private void loadInfo(String appId, Properties properties) { | ||
// Update the 4 Ids | ||
jobDefId = properties.getProperty(AZKABAN_JOB_URL); | ||
jobExecId = properties.getProperty(AZKABAN_ATTEMPT_URL); | ||
flowDefId = properties.getProperty(AZKABAN_WORKFLOW_URL); | ||
flowExecId = properties.getProperty(AZKABAN_EXECUTION_URL); | ||
|
||
// For Azkaban, The url and ids are the same | ||
jobExecUrl = jobExecId; | ||
jobDefUrl = jobDefId; | ||
flowExecUrl = flowExecId; | ||
flowDefUrl = flowDefId; | ||
|
||
workflowDepth = 0; // TODO: Add sub-workflow support | ||
jobName = properties.getProperty(AZKABAN_JOB_NAME); | ||
} | ||
|
||
@Override | ||
public String getSchedulerName() { | ||
return SCHEDULER_NAME; | ||
} | ||
|
||
@Override | ||
public String getJobDefId() { | ||
return jobDefId; | ||
} | ||
|
||
@Override | ||
public String getJobExecId() { | ||
return jobExecId; | ||
} | ||
|
||
@Override | ||
public String getFlowDefId() { | ||
return flowDefId; | ||
} | ||
|
||
@Override | ||
public String getFlowExecId() { | ||
return flowExecId; | ||
} | ||
|
||
@Override | ||
public String getJobDefUrl() { | ||
return jobDefUrl; | ||
} | ||
|
||
@Override | ||
public String getJobExecUrl() { | ||
return jobExecUrl; | ||
} | ||
|
||
@Override | ||
public String getFlowDefUrl() { | ||
return flowDefUrl; | ||
} | ||
|
||
@Override | ||
public String getFlowExecUrl() { | ||
return flowExecUrl; | ||
} | ||
|
||
@Override | ||
public int getWorkflowDepth() { | ||
return workflowDepth; | ||
} | ||
|
||
@Override | ||
public String getJobName() { | ||
return jobName; | ||
} | ||
} |
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,101 @@ | ||
/* | ||
* Copyright 2016 LinkedIn Corp. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
* use this file except in compliance with the License. You may obtain a copy of | ||
* the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
* License for the specific language governing permissions and limitations under | ||
* the License. | ||
*/ | ||
|
||
package com.linkedin.drelephant.schedulers; | ||
|
||
|
||
/** | ||
* Scheduler interface defining the | ||
*/ | ||
public interface Scheduler { | ||
|
||
/** | ||
* Return the Scheduler Name | ||
* | ||
* @return the scheduler name | ||
*/ | ||
public String getSchedulerName(); | ||
|
||
/** | ||
* Return the Job Definition Id of the job in the workflow | ||
* | ||
* @return the job definition id | ||
*/ | ||
public String getJobDefId(); | ||
|
||
/** | ||
* Return the Job Execution Id of the job in the workflow | ||
* | ||
* @return the job execution id | ||
*/ | ||
public String getJobExecId(); | ||
|
||
/** | ||
* Return the Flow Definition Id of the workflow | ||
* | ||
* @return the flow definition id | ||
*/ | ||
public String getFlowDefId(); | ||
|
||
/** | ||
* Return the Flow Execution Id of the workflow | ||
* | ||
* @return the flow execution id | ||
*/ | ||
public String getFlowExecId(); | ||
|
||
/** | ||
* Return a link to the job's definition | ||
* | ||
* @return the job definition url | ||
*/ | ||
public String getJobDefUrl(); | ||
|
||
/** | ||
* Return a link to the job's execution | ||
* | ||
* @return the job execution url | ||
*/ | ||
public String getJobExecUrl(); | ||
|
||
/** | ||
* Return a link to the flow's definition | ||
* | ||
* @return the flow definition url | ||
*/ | ||
public String getFlowDefUrl(); | ||
|
||
/** | ||
* Return a link to the flow's execution | ||
* | ||
* @return the flow execution url | ||
*/ | ||
public String getFlowExecUrl(); | ||
|
||
/** | ||
* Return the name of the Job/Action in the Flow | ||
* | ||
* @return the job/action name | ||
*/ | ||
public String getJobName(); | ||
|
||
/** | ||
* Return the workflow depth | ||
* | ||
* @return the workflow depth | ||
*/ | ||
public int getWorkflowDepth(); | ||
} |
Oops, something went wrong.