Skip to content

Commit

Permalink
Merge branch 'release/v3.0.12'
Browse files Browse the repository at this point in the history
  • Loading branch information
dbolotin committed Nov 20, 2019
2 parents 9d22b8b + 11871a0 commit ace1ef9
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 39 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@

MiXCR 3.0.12 (20 Nov 2019)
========================

-- Built-in reference library upgraded to v1.6 (see
[changelog](https://github.com/repseqio/library/releases/tag/v1.6))
-- Additional `mixcr` script optimizations for docker


MiXCR 3.0.11 (24 Oct 2019)
========================

Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ to upgrade already installed MiXCR to the newest version:
brew update
brew upgrade mixcr

#### Docker

See [official Docker Image](https://hub.docker.com/r/milaboratory/mixcr).

#### Manual install (any OS)

* download latest stable MiXCR build from [release page](https://github.com/milaboratory/mixcr/releases/latest)
Expand Down Expand Up @@ -104,7 +108,7 @@ To build MiXCR from source:

## License

Copyright (c) 2014-2018, Bolotin Dmitry, Chudakov Dmitry, Shugay Mikhail
Copyright (c) 2014-2019, Bolotin Dmitry, Chudakov Dmitry, Shugay Mikhail
(here and after addressed as Inventors)
All Rights Reserved

Expand Down
89 changes: 55 additions & 34 deletions mixcr
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env bash

app="mixcr"
defaultXmx=12000

java="java"

sedString1="s/\s*\([^.]*\)\..*/\1/"
Expand Down Expand Up @@ -31,48 +34,68 @@ fi
function readlinkUniversal() {
targetFile=$1

cd $(dirname $targetFile)
cd $(dirname "$targetFile")
targetFile=$(basename $targetFile)

# iterate down a (possible) chain of symlinks
while [ -L "$targetFile" ]; do
targetFile=$(readlink $targetFile)
cd $(dirname $targetFile)
cd $(dirname "$targetFile")
targetFile=$(basename $targetFile)
done

# compute the canonicalized name by finding the physical path
# for the directory we're in and appending the target file.
phys_dir=$(pwd -P)
result=$phys_dir/$targetFile
echo $result
echo "$result"
}

os=$(uname)
delta=100

dir=""

maxMb="???"

function calculateMaxMb() {
case $os in
Darwin)
freeBlocks=$(vm_stat | grep free | awk '{ print $3 }' | sed 's/\.//')
inactiveBlocks=$(vm_stat | grep inactive | awk '{ print $3 }' | sed 's/\.//')
speculativeBlocks=$(vm_stat | grep speculative | awk '{ print $3 }' | sed 's/\.//')
freeMb=$(((freeBlocks + speculativeBlocks) * 4096 / 1048576))
inactiveMb=$((inactiveBlocks * 4096 / 1048576))
maxMb=$(((freeMb + inactiveMb - delta)))
;;
Linux)
rFreeMb=$(free -m | grep Mem | awk '{ print $4 }')
maxMb=$((rFreeMb - delta))
;;
FreeBSD)
freeBlocks=$(vmstat -s | grep -E 'free$' | awk '{ print $1 }')
inactiveBlocks=$(vmstat -s | grep inactive | awk '{ print $1 }')
freeMb=$(((freeBlocks + inactiveBlocks) * 4096 / 1048576))
maxMb=$((freeMb - delta))
;;
*)
echo "Unknown OS."
exit 1
;;
esac
if [[ -n ${MAX_MEMORY_OVERRIDE+x} ]]; then
maxMb="${MAX_MEMORY_OVERRIDE}"
fi
}

case $os in
Darwin)
freeBlocks=$(vm_stat | grep free | awk '{ print $3 }' | sed 's/\.//')
inactiveBlocks=$(vm_stat | grep inactive | awk '{ print $3 }' | sed 's/\.//')
speculativeBlocks=$(vm_stat | grep speculative | awk '{ print $3 }' | sed 's/\.//')
freeMb=$((($freeBlocks + $speculativeBlocks) * 4096 / 1048576))
inactiveMb=$(($inactiveBlocks * 4096 / 1048576))
maxMb=$((($freeMb + $inactiveMb - $delta)))
dir=$(dirname "$(readlinkUniversal "$0")")
;;
Linux)
rFreeMb=$(free -m | grep Mem | awk '{ print $4 }')
maxMb=$(($rFreeMb - $delta))
dir="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
;;
FreeBSD)
freeBlocks=$(vmstat -s | grep -E 'free$' | awk '{ print $1 }')
inactiveBlocks=$(vmstat -s | grep inactive | awk '{ print $1 }')
freeMb=$((($freeBlocks + $inactiveBlocks) * 4096 / 1048576))
maxMb=$(($freeMb - $delta))
dir=$(dirname "$(readlinkUniversal "$0")")
;;
*)
Expand All @@ -81,28 +104,24 @@ FreeBSD)
;;
esac

if [[ -n ${MAX_MEMORY_OVERRIDE+x} ]]; then
maxMb="${MAX_MEMORY_OVERRIDE}"
fi

mixcrArgs=()
appArgs=()
javaArgs=()

needXmxXms=true
otherJar=""
altJar=""

inDocker=false

if [[ -f /proc/1/cgroup ]] && grep docker /proc/1/cgroup -qa; then
inDocker=true
fi

while [[ $# > 0 ]]; do
while [[ $# -gt 0 ]]; do
key="$1"
shift
case $key in
-D* | -X* | -ea | -agentlib*)
javaArgs+=(${key})
javaArgs+=("${key}")

case $key in
-Xmx* | -Xms*)
Expand All @@ -112,34 +131,36 @@ while [[ $# > 0 ]]; do

;;
-jar | -V)
otherJar="$1"
altJar="$1"
shift
;;
*)
mixcrArgs+=("${key}")
appArgs+=("${key}")
;;
esac
done

mixcr=${dir}/mixcr
scr=${dir}/scr

if [[ ! -z ${otherJar} ]]; then
mixcr="${mixcr} -V ${otherJar}"
if [[ -n ${altJar} ]]; then
scr="${scr} -V ${altJar}"
fi

if [[ ${needXmxXms} == true ]]; then
if [[ ${inDocker} == true ]] && [[ jVersion -ge 11 ]]; then
javaArgs+=("-XX:MaxRAMPercentage=85.0")
else
targetXmx=12000
targetXmx=$defaultXmx

calculateMaxMb

if [[ $targetXmx -gt $maxMb ]]; then
targetXmx=$maxMb
fi

javaArgs+=("-Xmx${targetXmx}m")

targetXms=$((${targetXmx} * 2 / 3))
targetXms=$((targetXmx * 2 / 3))

if [[ $targetXms -lt 2000 ]]; then
targetXms=$targetXmx
Expand All @@ -151,15 +172,15 @@ fi

jar=""

if [[ -z "$otherJar" ]]; then
for j in "$dir/../jar/mixcr.jar" "$dir/mixcr.jar" $(ls -d -1 $dir/target/* 2>/dev/null | grep distribution.jar); do
if [[ -z "$altJar" ]]; then
for j in "$dir/../jar/${app}.jar" "$dir/${app}.jar" $(ls -d -1 "$dir"/target/* 2>/dev/null | grep "${app}" | grep distribution.jar); do
if [[ -e "$j" ]]; then
jar=$j
break
fi
done
else
for j in $(ls -1 ${dir}/* | grep "mixcr" | grep ".jar" | grep ${otherJar}); do
for j in $(ls -1 "${dir}"/* | grep "${app}" | grep ".jar" | grep "${altJar}"); do
if [[ -e "$j" ]]; then
jar=$j
break
Expand All @@ -172,6 +193,6 @@ if [[ "$jar" == "" ]]; then
exit 1
fi

$java -Dmixcr.path=$dir -Dmixcr.command=mixcr "${javaArgs[@]}" -jar $jar "${mixcrArgs[@]}"
$java -D${app}.path="$dir" -D${app}.command=scr "${javaArgs[@]}" -jar "$jar" "${appArgs[@]}"

exit $?
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@

<groupId>com.milaboratory</groupId>
<artifactId>mixcr</artifactId>
<version>3.0.11</version>
<version>3.0.12</version>
<packaging>jar</packaging>
<name>MiXCR</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<milib.version>1.11</milib.version>
<milib.version>1.12</milib.version>
</properties>

<dependencies>
<dependency>
<groupId>io.repseq</groupId>
<artifactId>repseqio</artifactId>
<version>1.3.2</version>
<version>1.3.3</version>
<exclusions>
<exclusion>
<groupId>com.milaboratory</groupId>
Expand Down
2 changes: 1 addition & 1 deletion repseqio

0 comments on commit ace1ef9

Please sign in to comment.