Skip to content

Commit

Permalink
Rename TonY History Server to TonY Portal #254 (#255)
Browse files Browse the repository at this point in the history
* Rename TonY History Server to TonY Portal #254

* Fix a few last remnants of THS

* Expand wildcard imports in tony-portal tests
  • Loading branch information
erwa authored Apr 24, 2019
1 parent 0145134 commit 63b03ce
Show file tree
Hide file tree
Showing 42 changed files with 52 additions and 63 deletions.
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ dependency-reduced-pom.xml
log/
out/
target
tony-history-server/conf/*.jks
tony-history-server/conf/application.conf
tony-history-server/conf/prod.conf
tony-history-server/logs
tony-portal/conf/*.jks
tony-portal/conf/application.conf
tony-portal/conf/prod.conf
tony-portal/logs
tony.xml
!tony-core/src/test/resources/*.zip
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ rootProject.name = 'tony'
*/
rootProject.name = 'tony'

def modules = ['tony-azkaban', 'tony-core', 'tony-cli', 'tony-mini', 'tony-proxy', 'tony-history-server']
def modules = ['tony-azkaban', 'tony-core', 'tony-cli', 'tony-mini', 'tony-proxy', 'tony-portal']

modules.each { module ->
if (!file(module).directory) {
Expand Down
5 changes: 3 additions & 2 deletions tony-core/src/main/java/com/linkedin/tony/TonyClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -939,8 +939,9 @@ public boolean monitorApplication()
+ ", DSFinalStatus=" + dsStatus.toString() + ", breaking monitoring loop.");
// Set amRpcClient to null so client does not try to connect to it after completion.
amRpcClient = null;
String histHost = tonyConf.get(TonyConfigurationKeys.TONY_HISTORY_HOST, TonyConfigurationKeys.DEFAULT_TONY_HISTORY_HOST);
Utils.printTHSUrl(histHost, appId.toString(), LOG);
String tonyPortalUrl =
tonyConf.get(TonyConfigurationKeys.TONY_PORTAL_URL, TonyConfigurationKeys.DEFAULT_TONY_PORTAL_URL);
Utils.printTonyPortalUrl(tonyPortalUrl, appId.toString(), LOG);
return FinalApplicationStatus.SUCCEEDED == dsStatus;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ private TonyConfigurationKeys() {
public static final String TONY_HISTORY_FINISHED = TONY_PREFIX + "history.finished";
public static final String DEFAULT_TONY_HISTORY_FINISHED = DEFAULT_TONY_HISTORY_LOCATION + "/finished";

public static final String TONY_HISTORY_CACHE_MAX_ENTRIES = TONY_PREFIX + "history.cache.max-entries";
public static final String DEFAULT_TONY_HISTORY_CACHE_MAX_ENTRIES = "1000";
public static final String TONY_PORTAL_CACHE_MAX_ENTRIES = TONY_PREFIX + "portal.cache.max-entries";
public static final String DEFAULT_TONY_PORTAL_CACHE_MAX_ENTRIES = "1000";

public static final String TONY_KEYTAB_USER = TONY_PREFIX + "keytab.user";
public static final String DEFAULT_TONY_KEYTAB_USER = "user";
Expand Down Expand Up @@ -75,11 +75,8 @@ private TonyConfigurationKeys() {
public static final String TONY_SECRET_KEY = TONY_PREFIX + "secret.key";
public static final String DEFAULT_TONY_SECRET_KEY = "changeme";

public static final String TONY_HISTORY_MAX_APPEND = TONY_PREFIX + "history.maxAppends";
public static final int DEFAULT_TONY_HISTORY_MAX_APPEND = 3;

public static final String TONY_HISTORY_HOST = TONY_PREFIX + "history.host";
public static final String DEFAULT_TONY_HISTORY_HOST = "https://localhost:" + DEFAULT_TONY_HTTPS_PORT;
public static final String TONY_PORTAL_URL = TONY_PREFIX + "portal.url";
public static final String DEFAULT_TONY_PORTAL_URL = "https://localhost:" + DEFAULT_TONY_HTTPS_PORT;

// Application configurations
public static final String YARN_QUEUE_NAME = TONY_PREFIX + "yarn.queue";
Expand Down
5 changes: 2 additions & 3 deletions tony-core/src/main/java/com/linkedin/tony/util/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,8 @@ public static void printTaskUrl(TaskInfo taskInfo, Log log) {
log.info(String.format("Logs for %s %s at: %s", taskInfo.getName(), taskInfo.getIndex(), taskInfo.getUrl()));
}

public static void printTHSUrl(String thsHost, String appId, Log log) {
log.info(
String.format("Link for %s's events/metrics: %s/%s/%s", appId, thsHost, Constants.JOBS_SUFFIX, appId));
public static void printTonyPortalUrl(String portalUrl, String appId, Log log) {
log.info(String.format("Link for %s's events/metrics: %s/%s/%s", appId, portalUrl, Constants.JOBS_SUFFIX, appId));
}

/**
Expand Down
16 changes: 4 additions & 12 deletions tony-core/src/main/resources/tony-default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,9 @@
<!--All the configurations below should be set in $TONY_CONF_DIR/tony-site.xml-->
<property>
<description>
Hostname of history server
URL of the TonY Portal
</description>
<name>tony.history.host</name>
<name>tony.portal.url</name>
<value>https://localhost:19886</value>
</property>

Expand Down Expand Up @@ -250,10 +250,10 @@

<property>
<description>
Maximum (approximate) number of cache entries THS
Maximum (approximate) number of cache entries TonY Portal
will store for each cache (config, metadata, event)
</description>
<name>tony.history.cache.max-entries</name>
<name>tony.portal.cache.max-entries</name>
<value>1000</value>
</property>

Expand Down Expand Up @@ -321,12 +321,4 @@
<name>tony.secret.key</name>
<value>changeme</value>
</property>

<property>
<description>
Number of times the AM tries append the event to buffer (Avro's DataWriter).
</description>
<name>tony.history.maxAppends</name>
<value>3</value>
</property>
</configuration>
32 changes: 16 additions & 16 deletions tony-history-server/README.md → tony-portal/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Tony History Server
# Tony Portal

## Development

Expand All @@ -8,47 +8,47 @@ Assuming you are in the root `TonY` folder:

- To build the project:
```
$ ./gradlew :tony-history-server:build
$ ./gradlew :tony-portal:build
```

- To run the app locally:

First, copy `tony-history-server/conf/application.example.conf` to `tony-history-server/conf/application.conf`
First, copy `tony-portal/conf/application.example.conf` to `tony-portal/conf/application.conf`
and set all the necessary configurations. Locally, you probably don't have Kerberos security set up, so you can
ignore setting the `keytab` properties.

```
$ ./gradlew :tony-history-server:runPlayBinary
$ ./gradlew :tony-portal:runPlayBinary
```

**Note:** this will only reload when receiving new request, __not__ when file changes. For reloading on file changes (hot reloading):
```
$ ./gradlew :tony-history-server:runPlayBinary -t
$ ./gradlew :tony-portal:runPlayBinary -t
```

- After the message `<=============> 100% EXECUTING ...` displays, go to <http://localhost:9000> on your browser to see the app.

Initially, there won't be any data, but there is some example data in `tony-history-server/example/tony-history`
Initially, there won't be any data, but there is some example data in `tony-portal/example/tony-history`
you can load by copying it to `/tmp`:

```
cp -r tony-history-server/example/tony-history /tmp
cp -r tony-portal/example/tony-history /tmp
```

Double-check that the `history` configs in `tony-history-server/conf/application.conf` point to `/tmp/tony-history`.
Double-check that the `history` configs in `tony-portal/conf/application.conf` point to `/tmp/tony-history`.

- To run tests:
```
$ ./gradlew :tony-history-server:testPlayBinary
$ ./gradlew :tony-portal:testPlayBinary
```

For more info about developing with Play using Gradle, click [here](https://docs.gradle.org/current/userguide/play_plugin.html#play_continuous_build).


## Production

1. Create the production zip by running `./gradlew :tony-history-server:createPlayBinaryZipDist`.
The zip should be created in `tony-history-server/build/distributions`.
1. Create the production zip by running `./gradlew :tony-portal:createPlayBinaryZipDist`.
The zip should be created in `tony-portal/build/distributions`.
2. Copy the zip to your production host.
3. Unzip it.
4. Optional: Before running the production binary, all the configurations for Tony History Server should be
Expand All @@ -58,15 +58,15 @@ to set up your own `tony-site.xml`. If needed, run
# should contain `tony-site.xml` inside it
export TONY_CONF_DIR=/path/to/tony/config/folder`
```
5. `cd tony-history-server-*`
6. Run `bin/startTHS.sh`. See [script](./startTHS.sh) for more details.
5. `cd tony-portal-*`
6. Run `bin/startTonyPortal.sh`. See [script](./startTonyPortal.sh) for more details.

Steps (1) and (2) can also be done together by running the `./buildAndDeploy.sh` script
(see [Deployment](#deployment) section below).

To stop the THS, run
To stop the TonY Portal, run
```
bin/stopTHS.sh
bin/stopTonyPortal.sh
```


Expand All @@ -76,7 +76,7 @@ Before using the script, ensure that you have set execution permission (`chmod +

- To bundle the history server app and copy it to another host
```
# must be run from the tony-history-server folder
# must be run from the tony-portal folder
$ ./buildAndDeploy.sh user hostname.test.abc.com
```

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public class CacheWrapper {
@Inject
public CacheWrapper(Config appConf) {
int maxCacheSz = Integer.parseInt(
ConfigUtils.fetchConfigIfExists(appConf, TonyConfigurationKeys.TONY_HISTORY_CACHE_MAX_ENTRIES,
TonyConfigurationKeys.DEFAULT_TONY_HISTORY_CACHE_MAX_ENTRIES));
ConfigUtils.fetchConfigIfExists(appConf, TonyConfigurationKeys.TONY_PORTAL_CACHE_MAX_ENTRIES,
TonyConfigurationKeys.DEFAULT_TONY_PORTAL_CACHE_MAX_ENTRIES));
metadataCache = CacheBuilder.newBuilder().maximumSize(maxCacheSz).build();
configCache = CacheBuilder.newBuilder().maximumSize(maxCacheSz).build();
eventCache = CacheBuilder.newBuilder().maximumSize(maxCacheSz).build();
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<section id="top">
<div class="wrapper">
<img class="resize" src='@routes.Assets.versioned("images/banner-logo.png")' alt="logo" />
<h1>TonY History Server</h1>
<h1>TonY Portal</h1>
</div>
</section>
@content
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env sh
###########################################################################################################
# NAME: startTHS.sh
# NAME: startTonyPortal.sh
#
# DESCRIPTION:
# This is a modified version of the `playBinary` script that was generated after `gradle dist`.
Expand All @@ -16,7 +16,7 @@
# NOTES: This script should only be run when it's in the distribution zip/tar.
# Examples: after `gradle dist` from root, unzip the zip/tar in $root/build/distributions, then run:
# ```
# $ <tony-root>/build/distributions/startTHS.sh
# $ <tony-root>/build/distributions/startTonyPortal.sh
# ```
#
#
Expand Down Expand Up @@ -45,7 +45,7 @@ cd "`dirname \"$PRG\"`/.." >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_NAME="tony-history-server"
APP_NAME="tony-portal"
APP_BASE_NAME=`basename "$0"`

# Use the maximum available, or set MAX_FD != -1 to use that value.
Expand Down Expand Up @@ -86,7 +86,7 @@ esac
# We parse tony-site.xml and set properties using -D instead.
cp $APP_HOME/conf/application.example.conf $APP_HOME/conf/application.conf

CLASSPATH="$APP_HOME/lib/tony-history-server.jar:$APP_HOME/conf"
CLASSPATH="$APP_HOME/lib/tony-portal.jar:$APP_HOME/conf"

# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
Expand Down Expand Up @@ -213,5 +213,5 @@ if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

# Run THS in the background
# Run TonY Portal in the background
nohup ${JAVACMD} ${OPTS} -classpath ${CLASSPATH} play.core.server.ProdServerStart &
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/usr/bin/env sh
###########################################################################################################
# NAME: stopTHS.sh
# NAME: stopTonyPortal.sh
#
# DESCRIPTION:
# This script stops the Tony History Server (THS) process.
# This script stops the Tony Portal process.
#
#
# INPUT:
# $1 - path of RUNNING_PID of THS (Optional. Default to current folder)
# $1 - path of RUNNING_PID of TonY Portal (Optional. Default to current folder)
#
#
# EXIT CODE:
Expand All @@ -31,4 +31,4 @@ fi

kill -9 $PID

rm $RUNNING_PID_PATH # So we can run startTHS.sh again
rm $RUNNING_PID_PATH # So we can run startTonyPortal.sh again
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import play.test.TestBrowser;
import play.test.WithBrowser;

import static org.junit.Assert.*;
import static play.test.Helpers.*;
import static org.junit.Assert.assertTrue;
import static play.test.Helpers.fakeApplication;


public class BrowserTest extends WithBrowser {
Expand All @@ -29,6 +29,6 @@ protected TestBrowser provideBrowser(int port) {
@Test
public void test() {
browser.goTo("http://localhost:" + play.api.test.Helpers.testServerPort());
assertTrue(browser.pageSource().contains("TonY History Server"));
assertTrue(browser.pageSource().contains("TonY Portal"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import play.inject.guice.GuiceApplicationBuilder;
import play.test.WithApplication;

import static org.junit.Assert.*;
import static play.mvc.Http.Status.*;
import static org.junit.Assert.assertEquals;
import static play.mvc.Http.Status.OK;


public class JobConfigPageControllerTest extends WithApplication {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import play.mvc.Result;
import play.test.WithApplication;

import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static play.mvc.Http.Status.OK;
import static play.test.Helpers.GET;
import static play.test.Helpers.route;
Expand Down

0 comments on commit 63b03ce

Please sign in to comment.