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

FITS with Nailgun? #214

Closed
jpstroop opened this issue Sep 27, 2015 · 2 comments
Closed

FITS with Nailgun? #214

jpstroop opened this issue Sep 27, 2015 · 2 comments
Labels

Comments

@jpstroop
Copy link
Contributor

Logging this here just so that I don't forget; not saying it's necessarily something we should do. I just noticed that FITS contains a script, fits-ngserver.sh that starts a Nailgun server, which would save us having to spin up the JVM for every call to FITS. We'd probably get a good performance boost.

#!/bin/bash
#
# This helper script launches a nailgun server with the FITS
# classpath, making it simple to launch a persistent JVM for FITS.
# 
# The one required parameter is the path to nailgun's jar; it can also be
# specified via the NAILGUN_JAR environment variable.

. "$(dirname $BASH_SOURCE)/fits-env.sh"

if [[ ! $NAILGUN_JAR ]] && [[ ! $1 ]]; then
        echo "Error: Path to Nailgun JAR must be specified!" >&2
        echo "Usage: fits-ngserver.sh [path-to-nailgun.jar]" >&2
        echo "The path may also be specified via the NAILGUN_JAR environment variable." >&2
        exit 64
else
        NAILGUN_JAR=$1
fi

cmd="java -classpath \"$APPCLASSPATH:$NAILGUN_JAR\" com.martiansoftware.nailgun.NGServer"

echo "You may now run FITS by typing: ng edu.harvard.hul.ois.fits.Fits [options]" >&2

eval "exec $cmd"
@jpstroop
Copy link
Contributor Author

me@here:~ $ fits-ngserver.sh $NAILGUN_JAR &
[1] 9820
me@here:~ $ You may now run FITS by typing: ng edu.harvard.hul.ois.fits.Fits [options]
Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/share/java/jayatanaag.jar 
NGServer started on all interfaces, port 2113.

me@here:~ $ time ng-nailgun edu.harvard.hul.ois.fits.Fits -i Desktop/pul-logo-tall-md-trans_0.png -o /tmp/sample.xml

real    0m1.854s // <------------------------------
user    0m0.000s
sys 0m0.000s
NGSession 1: 127.0.0.1: edu.harvard.hul.ois.fits.Fits exited with status 0
me@here:~ $ time ng-nailgun edu.harvard.hul.ois.fits.Fits -i Desktop/pul-logo-tall-md-trans_0.png -o /tmp/sample.xml

real    0m0.464s // <------------------------------
user    0m0.000s
sys 0m0.000s
NGSession 2: 127.0.0.1: edu.harvard.hul.ois.fits.Fits exited with status 0

@jpstroop
Copy link
Contributor Author

Closing, forgot that the actual call to fits was in a separate gem. Opened as a question in samvera/hydra-file_characterization#21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant