Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-tuning dashboard implementation Completed #613

Open
wants to merge 16 commits into
base: tuning_20190221
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions app-conf/elephant.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ enable_analytics=false
# Check https://www.playframework.com/documentation/2.2.x/ProductionConfiguration
# Adding the below line for Heap Tuning and Java OPTS
# Use mem for tuning Heap Memory
jvm_args="-Devolutionplugin=enabled -DapplyEvolutions.default=true -mem 1024 -J-Xloggc:$project_root../logs/elephant/dr-gc.`date +'%Y%m%d%H%M'` -J-XX:+PrintGCDetails"
jvm_args="-Devolutionplugin=disabled -DapplyEvolutions.default=true -mem 1024 -J-Xloggc:$project_root../logs/elephant/dr-gc.`date +'%Y%m%d%H%M'` -J-XX:+PrintGCDetails"


# Property enables dropwizard metrics for the application.
Expand Down Expand Up @@ -57,7 +57,7 @@ metrics=true
# metrics_agent_jar="-javaagent:lib/your_agent.jar=app-name=dr-elephant,app-host=foo"

#
#Filter for applications to be processed. This filter will be applied in API call to RM for getting
#applications finished in last window. Useful to restrict applications to be processed.
#Filter for applications to be processed. This filter will be applied in API call to RM for getting
#applications finished in last window. Useful to restrict applications to be processed.
#
#rm_application_filter="applicationTags=tag1&user=user1&applicationType=SPARK
48 changes: 31 additions & 17 deletions app/Global.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
/*
* 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.
*/

import com.linkedin.drelephant.DrElephant;
import com.sun.security.sasl.util.AbstractSaslImpl;

Expand All @@ -25,6 +9,11 @@
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.logging.Level;
import play.libs.F;
import play.mvc.Action;
import play.mvc.Http;
import play.mvc.Result;
import play.mvc.SimpleResult;


/**
Expand Down Expand Up @@ -87,4 +76,29 @@ static void setFinalStatic(Field field, Object newValue) throws Exception {
modifiersField.setInt(field, field.getModifiers() & ~Modifier.FINAL);
field.set(null, newValue);
}
}

private class ActionWrapper extends Action.Simple {
public ActionWrapper(Action<?> action) {
this.delegate = action;
}

@Override
public F.Promise<SimpleResult> call(Http.Context ctx) throws java.lang.Throwable {
F.Promise<SimpleResult> result = this.delegate.call(ctx);
Http.Response response = ctx.response();
response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Allow", "*");
response.setHeader("Access-Control-Allow-Methods", "POST, GET, PUT, DELETE, OPTIONS");
response.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept, Referer, User-Agent");
return result;
}
}

@Override
public Action<?> onRequest(Http.Request request, java.lang.reflect.Method actionMethod) {
return new ActionWrapper(super.onRequest(request, actionMethod));
}



}
Loading