-
Notifications
You must be signed in to change notification settings - Fork 858
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Arpan Agrawal <arpang@users.noreply.github.com> Co-authored-by: Manoj Kumar <mkumar1984@users.noreply.github.com>
- Loading branch information
Showing
57 changed files
with
5,884 additions
and
44 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
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,67 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
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. | ||
--> | ||
|
||
<!-- General configurations --> | ||
<configuration> | ||
<property> | ||
<name>autotuning.enabled</name> | ||
<value>false</value> | ||
<description>Enable or disable auto tuning</description> | ||
</property> | ||
<property> | ||
<name>autotuning.default.allowed_max_resource_usage_percent</name> | ||
<value>150</value> | ||
<description>Default value for maximum allowed overheard in resource usage (in percent) as compared to the average | ||
value | ||
</description> | ||
</property> | ||
<property> | ||
<name>autotuning.default.allowed_max_execution_time_percent</name> | ||
<value>150</value> | ||
<description>Default value for maximum allowed overheard in execution time (in percent) as compared to the average | ||
value | ||
</description> | ||
</property> | ||
<property> | ||
<name>autotuning.daemon.wait.interval.ms</name> | ||
<value>60000</value> | ||
<description>Auto tuning daemon wait interval</description> | ||
</property> | ||
<property> | ||
<name>baseline.execution.count</name> | ||
<value>30</value> | ||
<description>Baseline to be done on recent number of execution</description> | ||
</property> | ||
<property> | ||
<name>fitness.compute.wait_interval.ms</name> | ||
<value>1800000</value> | ||
<description>Wait time after the job is completed for fitness computation</description> | ||
</property> | ||
<property> | ||
<name>dr.elephant.api.url</name> | ||
<value>http://ltx1-holdemdre01.grid.linkedin.com:8080</value> | ||
<description>API URL for Dr Elephant. Optional. This is needed only if you are using APIFitnessComputeUtil to get | ||
fitness from Dr Elephant APIs | ||
</description> | ||
</property> | ||
<!--The below property is optional--> | ||
<!--<property>--> | ||
<!--<name>python.path</name>--> | ||
<!--<value>/path/to/python/binary</value>--> | ||
<!--<description>Root directory for python</description>--> | ||
<!--</property>--> | ||
</configuration> |
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,80 @@ | ||
/* | ||
* 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; | ||
|
||
import org.apache.hadoop.conf.Configuration; | ||
import org.apache.log4j.Logger; | ||
|
||
import com.linkedin.drelephant.analysis.HDFSContext; | ||
import com.linkedin.drelephant.tuning.AzkabanJobCompleteDetector; | ||
import com.linkedin.drelephant.tuning.BaselineComputeUtil; | ||
import com.linkedin.drelephant.tuning.FitnessComputeUtil; | ||
import com.linkedin.drelephant.tuning.JobCompleteDetector; | ||
import com.linkedin.drelephant.tuning.PSOParamGenerator; | ||
import com.linkedin.drelephant.tuning.ParamGenerator; | ||
import com.linkedin.drelephant.util.Utils; | ||
|
||
import controllers.AutoTuningMetricsController; | ||
|
||
|
||
/** | ||
*This class is the AutoTuner Daemon class which runs following thing in order. | ||
* - BaselineComputeUtil: Baseline computation for new jobs which are auto tuning enabled | ||
* - JobCompleteDetector: Detect if the current execution of the jobs is completed and update the status in DB | ||
* - APIFitnessComputeUtil: Compute the recently succeeded jobs fitness | ||
* - ParamGenerator : Generate the next set of parameters for suggestion | ||
*/ | ||
public class AutoTuner implements Runnable { | ||
|
||
public static final long ONE_MIN = 60 * 1000; | ||
private static final Logger logger = Logger.getLogger(AutoTuner.class); | ||
private static final long DEFAULT_METRICS_COMPUTATION_INTERVAL = ONE_MIN / 5; | ||
|
||
public static final String AUTO_TUNING_DAEMON_WAIT_INTERVAL = "autotuning.daemon.wait.interval.ms"; | ||
|
||
public void run() { | ||
|
||
logger.info("Starting Auto Tuning thread"); | ||
HDFSContext.load(); | ||
Configuration configuration = ElephantContext.instance().getAutoTuningConf(); | ||
|
||
Long interval = | ||
Utils.getNonNegativeLong(configuration, AUTO_TUNING_DAEMON_WAIT_INTERVAL, DEFAULT_METRICS_COMPUTATION_INTERVAL); | ||
|
||
try { | ||
AutoTuningMetricsController.init(); | ||
BaselineComputeUtil baselineComputeUtil = new BaselineComputeUtil(); | ||
FitnessComputeUtil fitnessComputeUtil = new FitnessComputeUtil(); | ||
ParamGenerator paramGenerator = new PSOParamGenerator(); | ||
while (!Thread.currentThread().isInterrupted()) { | ||
try { | ||
baselineComputeUtil.computeBaseline(); | ||
JobCompleteDetector jobCompleteDetector = new AzkabanJobCompleteDetector(); | ||
jobCompleteDetector.updateCompletedExecutions(); | ||
fitnessComputeUtil.updateFitness(); | ||
paramGenerator.getParams(); | ||
} catch (Exception e) { | ||
logger.error("Error in auto tuner thread ", e); | ||
} | ||
Thread.sleep(interval); | ||
} | ||
} catch (Exception e) { | ||
logger.error("Error in auto tuner thread ", e); | ||
} | ||
logger.info("Auto tuning thread shutting down"); | ||
} | ||
} |
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
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
Oops, something went wrong.