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

Reworked mango frontend to from scalatra to play #283

Open
wants to merge 4 commits into
base: master
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
18 changes: 9 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ parquettest.sh
.idea/
workfiles/
chr20/
mango-cli/src/main/webapp/resources/node_modules/pileup/dist/lib/
mango-cli/src/main/webapp/resources/node_modules/pileup/dist/main/
mango-cli/src/main/webapp/resources/node_modules/pileup/dist/test/
mango-cli/src/main/webapp/resources/node_modules/pileup/dist/test.js
mango-cli/src/main/webapp/resources/node_modules/pileup/dist/pileup.js
mango-cli/src/main/webapp/resources/node_modules/pileup/dist/pileup.js.map
mango-cli/src/main/webapp/resources/node_modules/pileup/dist/node_modules/
mango-cli/src/main/webapp/resources/node_modules/pileup/node_modules/
chr20/
mango-play-*
mango-play/public/resources/node_modules/pileup/dist/lib/
mango-play/public/resources/node_modules/pileup/dist/main/
mango-play/public/resources/node_modules/pileup/dist/test/
mango-play/public/resources/node_modules/pileup/dist/test.js
mango-play/public/resources/node_modules/pileup/dist/pileup.js
mango-play/public/resources/node_modules/pileup/dist/pileup.js.map
mango-play/public/resources/node_modules/pileup/dist/node_modules/
mango-play/public/resources/node_modules/pileup/node_modules/
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "mango-cli/src/main/webapp/resources/pileup.js"]
path = mango-cli/src/main/webapp/resources/pileup.js
[submodule "mango-play/public/resources/pileup.js"]
path = mango-play/public/resources/pileup.js
url = https://github.com/akmorrow13/pileup.js.git
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#mango
# mango

A scalable genome browser built on top of the [ADAM](https://github.com/bigdatagenomics/adam) genomics processing engine. Apache 2 licensed.

Expand Down Expand Up @@ -30,7 +30,9 @@ mango is packaged via [appassembler](http://mojo.codehaus.org/appassembler/appas

Running an example script:
```
From the main folder of mango, run ./example-files/run-example.sh to see a demonstration of chromosome 17, region 7500000-7515000.
From the main folder of mango, run ./scripts/run-example.sh to see a demonstration of chromosome 17, region 7500000-7515000.
```
**Note:** In local mode, relative paths are referenced from the mango-play submodule. To reference your own files, put in the absolute path.
```
For help launching the script, run `bin/mango-submit -h`
````
Expand Down
4 changes: 2 additions & 2 deletions bin/compute-mango-classpath.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ REPO="$SCRIPT_DIR/repo"

# Fallback to source repo
if [ ! -f $MANGO_CMD ]; then
MANGO_CMD="$SCRIPT_DIR/mango-cli/target/appassembler/bin/mango"
REPO="$SCRIPT_DIR/mango-cli/target/appassembler/repo"
MANGO_CMD="$SCRIPT_DIR/mango-play/target/appassembler/bin/mango"
REPO="$SCRIPT_DIR/mango-play/target/appassembler/repo"
fi

if [ ! -f "$MANGO_CMD" ]; then
Expand Down
64 changes: 64 additions & 0 deletions bin/compute-spark-jars.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/usr/bin/env bash
#
# Licensed to Big Data Genomics (BDG) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The BDG 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.
#

set -e
if [ -z "${SPARK_HOME}" ]; then
export SPARK_HOME="$(cd "`dirname "$0"`"/..; pwd)"
fi

. "${SPARK_HOME}"/bin/load-spark-env.sh

# Find the java binary
if [ -n "${JAVA_HOME}" ]; then
RUNNER="${JAVA_HOME}/bin/java"
else
if [ `command -v java` ]; then
RUNNER="java"
else
echo "JAVA_HOME is not set" >&2
exit 1
fi
fi

# Find assembly jar
SPARK_ASSEMBLY_JAR=
if [ -f "${SPARK_HOME}/RELEASE" ]; then
ASSEMBLY_DIR="${SPARK_HOME}/lib"
else
ASSEMBLY_DIR="${SPARK_HOME}/assembly/target/scala-$SPARK_SCALA_VERSION"
fi

GREP_OPTIONS=
num_jars="$(ls -1 "$ASSEMBLY_DIR" | grep "^spark-assembly.*hadoop.*\.jar$" | wc -l)"
if [ "$num_jars" -eq "0" -a -z "$SPARK_ASSEMBLY_JAR" -a "$SPARK_PREPEND_CLASSES" != "1" ]; then
echo "Failed to find Spark assembly in $ASSEMBLY_DIR." 1>&2
echo "You need to build Spark before running this program." 1>&2
exit 1
fi
if [ -d "$ASSEMBLY_DIR" ]; then
ASSEMBLY_JARS="$(ls -1 "$ASSEMBLY_DIR" | grep "^spark-assembly.*hadoop.*\.jar$" || true)"
if [ "$num_jars" -gt "1" ]; then
echo "Found multiple Spark assembly jars in $ASSEMBLY_DIR:" 1>&2
echo "$ASSEMBLY_JARS" 1>&2
echo "Please remove all but one jar." 1>&2
exit 1
fi
fi

echo "${ASSEMBLY_DIR}/${ASSEMBLY_JARS}"
28 changes: 28 additions & 0 deletions bin/mango-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
#
# Licensed to Big Data Genomics (BDG) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The BDG 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.
#

set -e

SCRIPT_DIR="$(cd `dirname $0`/..; pwd)"

# build mango-play distribution
mvn -f $SCRIPT_DIR play2:dist -pl mango-play

# unzip new dist directory
unzip -o "$SCRIPT_DIR/mango-play/target/mango-play-0.0.1-SNAPSHOT-dist.zip" -d $SCRIPT_DIR
36 changes: 26 additions & 10 deletions bin/mango-submit
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,29 @@ if [ -z "$SPARK_SUBMIT" ]; then
fi
echo "Using SPARK_SUBMIT=$SPARK_SUBMIT"

# submit the job to Spark
"$SPARK_SUBMIT" \
--class org.bdgenomics.mango.cli.VizReads \
--conf spark.serializer=org.apache.spark.serializer.KryoSerializer \
--conf spark.kryo.registrator=org.bdgenomics.mango.serialization.MangoKryoRegistrator \
--conf spark.dynamicAllocation.executorIdleTimeout=10d \
--conf spark.driver.memory=5g \
$SPARK_ARGS \
$MANGO_CLI_JAR \
$MANGO_ARGS
# exports
export SPARK_ARGS=$SPARK_ARGS
export MANGO_MAIN_JAR=$MANGO_CLI_JAR
export MANGO_ARGS=$MANGO_ARGS

# generate application key
APP_KEY=$(openssl rand -base64 15)
export APPLICATION_SECRET=$APP_KEY

SCRIPT_DIR="$(cd `dirname $0`/..; pwd)"

# get version of mango from maven. This will be used to fetch the
# most recently installed mango-play distribution
MANGO_VERSION=`echo -e 'setns x=http://maven.apache.org/POM/4.0.0\ncat /x:project/x:version/text()' | xmllint --shell $SCRIPT_DIR/pom.xml | grep -v /`

classpath="$SCRIPT_DIR/mango-play-$MANGO_VERSION/lib/*"

# Get list of provided jars for spark
SPARK_JARS=$("$SCRIPT_DIR"/bin/compute-spark-jars.sh)

# modify classpath to include spark and hadoop
# spark must come second do to dependency conflicts
classpath="$classpath:$SPARK_JARS"

# this is copied from playframework's autogenerated start script
exec java $* -cp "$classpath" play.core.server.NettyServer $scriptdir
Loading