Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
YARN-3541. Add version info on timeline service / generic history web…
… UI and REST API. Contributed by Zhijie Shen
- Loading branch information
Showing
14 changed files
with
404 additions
and
43 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
116 changes: 116 additions & 0 deletions
116
...oop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/timeline/TimelineAbout.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,116 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you 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 org.apache.hadoop.yarn.api.records.timeline; | ||
|
||
|
||
import org.apache.hadoop.classification.InterfaceAudience; | ||
import org.apache.hadoop.classification.InterfaceStability; | ||
|
||
import javax.xml.bind.annotation.XmlAccessType; | ||
import javax.xml.bind.annotation.XmlAccessorType; | ||
import javax.xml.bind.annotation.XmlElement; | ||
import javax.xml.bind.annotation.XmlRootElement; | ||
|
||
@XmlRootElement(name = "about") | ||
@XmlAccessorType(XmlAccessType.NONE) | ||
@InterfaceAudience.Public | ||
@InterfaceStability.Evolving | ||
public class TimelineAbout { | ||
|
||
private String about; | ||
private String timelineServiceVersion; | ||
private String timelineServiceBuildVersion; | ||
private String timelineServiceVersionBuiltOn; | ||
private String hadoopVersion; | ||
private String hadoopBuildVersion; | ||
private String hadoopVersionBuiltOn; | ||
|
||
public TimelineAbout() { | ||
} | ||
|
||
public TimelineAbout(String about) { | ||
this.about = about; | ||
} | ||
|
||
@XmlElement(name = "About") | ||
public String getAbout() { | ||
return about; | ||
} | ||
|
||
public void setAbout(String about) { | ||
this.about = about; | ||
} | ||
|
||
@XmlElement(name = "timeline-service-version") | ||
public String getTimelineServiceVersion() { | ||
return timelineServiceVersion; | ||
} | ||
|
||
public void setTimelineServiceVersion(String timelineServiceVersion) { | ||
this.timelineServiceVersion = timelineServiceVersion; | ||
} | ||
|
||
@XmlElement(name = "timeline-service-build-version") | ||
public String getTimelineServiceBuildVersion() { | ||
return timelineServiceBuildVersion; | ||
} | ||
|
||
public void setTimelineServiceBuildVersion( | ||
String timelineServiceBuildVersion) { | ||
this.timelineServiceBuildVersion = timelineServiceBuildVersion; | ||
} | ||
|
||
@XmlElement(name = "timeline-service-version-built-on") | ||
public String getTimelineServiceVersionBuiltOn() { | ||
return timelineServiceVersionBuiltOn; | ||
} | ||
|
||
public void setTimelineServiceVersionBuiltOn( | ||
String timelineServiceVersionBuiltOn) { | ||
this.timelineServiceVersionBuiltOn = timelineServiceVersionBuiltOn; | ||
} | ||
|
||
@XmlElement(name = "hadoop-version") | ||
public String getHadoopVersion() { | ||
return hadoopVersion; | ||
} | ||
|
||
public void setHadoopVersion(String hadoopVersion) { | ||
this.hadoopVersion = hadoopVersion; | ||
} | ||
|
||
@XmlElement(name = "hadoop-build-version") | ||
public String getHadoopBuildVersion() { | ||
return hadoopBuildVersion; | ||
} | ||
|
||
public void setHadoopBuildVersion(String hadoopBuildVersion) { | ||
this.hadoopBuildVersion = hadoopBuildVersion; | ||
} | ||
|
||
@XmlElement(name = "hadoop-version-built-on") | ||
public String getHadoopVersionBuiltOn() { | ||
return hadoopVersionBuiltOn; | ||
} | ||
|
||
public void setHadoopVersionBuiltOn(String hadoopVersionBuiltOn) { | ||
this.hadoopVersionBuiltOn = hadoopVersionBuiltOn; | ||
} | ||
} | ||
|
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
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
47 changes: 47 additions & 0 deletions
47
.../main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AboutBlock.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,47 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you 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 org.apache.hadoop.yarn.server.applicationhistoryservice.webapp; | ||
|
||
import com.google.inject.Inject; | ||
import org.apache.hadoop.util.VersionInfo; | ||
import org.apache.hadoop.yarn.api.records.timeline.TimelineAbout; | ||
import org.apache.hadoop.yarn.util.YarnVersionInfo; | ||
import org.apache.hadoop.yarn.util.timeline.TimelineUtils; | ||
import org.apache.hadoop.yarn.webapp.View; | ||
import org.apache.hadoop.yarn.webapp.view.HtmlBlock; | ||
import org.apache.hadoop.yarn.webapp.view.InfoBlock; | ||
|
||
public class AboutBlock extends HtmlBlock { | ||
@Inject | ||
AboutBlock(View.ViewContext ctx) { | ||
super(ctx); | ||
} | ||
|
||
@Override | ||
protected void render(Block html) { | ||
TimelineAbout tsInfo = TimelineUtils.createTimelineAbout( | ||
"Timeline Server - Generic History Service UI"); | ||
info("Timeline Server Overview"). | ||
_("Timeline Server Version:", tsInfo.getTimelineServiceBuildVersion() + | ||
" on " + tsInfo.getTimelineServiceVersionBuiltOn()). | ||
_("Hadoop Version:", tsInfo.getHadoopBuildVersion() + | ||
" on " + tsInfo.getHadoopVersionBuiltOn()); | ||
html._(InfoBlock.class); | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
...c/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/webapp/AboutPage.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,36 @@ | ||
/** | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you 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 org.apache.hadoop.yarn.server.applicationhistoryservice.webapp; | ||
|
||
|
||
import org.apache.hadoop.yarn.webapp.SubView; | ||
import org.apache.hadoop.yarn.webapp.YarnWebParams; | ||
|
||
import static org.apache.hadoop.yarn.util.StringHelper.join; | ||
|
||
public class AboutPage extends AHSView { | ||
@Override protected void preHead(Page.HTML<_> html) { | ||
commonPreHead(html); | ||
set(TITLE, "Timeline Server - Generic History Service"); | ||
} | ||
|
||
@Override protected Class<? extends SubView> content() { | ||
return AboutBlock.class; | ||
} | ||
} |
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.