com.tencent.angel.webapp.page.EnvironmentBlock Maven / Gradle / Ivy
/*
* Tencent is pleased to support the open source community by making Angel available.
*
* Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved.
*
* 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
*
* https://opensource.org/licenses/Apache-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.tencent.angel.webapp.page;
import com.google.inject.Inject;
import com.tencent.angel.conf.AngelConf;
import com.tencent.angel.master.app.AMContext;
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet;
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TABLE;
import org.apache.hadoop.yarn.webapp.hamlet.Hamlet.TBODY;
import org.apache.hadoop.yarn.webapp.view.HtmlBlock;
import java.util.*;
import static org.apache.hadoop.yarn.util.StringHelper.join;
import static org.apache.hadoop.yarn.webapp.view.JQueryUI._TH;
// import org.apache.hadoop.conf.Configuration;
// import java.lang.reflect.Field;
public class EnvironmentBlock extends HtmlBlock {
final AMContext amContext;
@Inject EnvironmentBlock(AMContext amctx) {
amContext = amctx;
}
@Override protected void render(Block html) {
set(TITLE, join("Angel Environment"));
html.h1("Runtime Information");
TABLE run_info_table = html.table();
String UsrHome = System.getProperty("user.home");
String UsrDir = System.getProperty("user.dir");
String UsrName = System.getProperty("user.name");
String JavaHome = System.getProperty("java.home");
String OsNmae = System.getProperty("os.name");
String JavaVersion = System.getProperty("java.version");
run_info_table.tr().th(_TH, "NAME").th(_TH, "VALUE")._();
run_info_table.tr().td("UsrHome").td(UsrHome)._().tr().td("UsrDir").td(UsrDir)._().tr()
.td("UsrName").td(UsrName)._().tr().td("JavaHome").td(JavaHome)._().tr().td("OsNmae")
.td(OsNmae)._().tr().td("JavaVersion").td(JavaVersion)._();
run_info_table._();
html.h1(" ");
html.h1("Angel Properties");
TABLE angel_properties_table = html.table();
angel_properties_table.tr().th(_TH, "NAME").th(_TH, "VALUE")._();
AngelConf angelConfiguration = new AngelConf(this.amContext.getConf());
Properties propertiesConfiguration = angelConfiguration.getAngelProps();
SortedMap sortedMap = new TreeMap(propertiesConfiguration);
Set