Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LarvaTagger.jl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nyx
LarvaTagger.jl
Commits
9ae6a5b9
Commit
9ae6a5b9
authored
11 months ago
by
François LAURENT
Browse files
Options
Downloads
Patches
Plain Diff
feat: verbose logging for externally sourced variables
parent
53f78614
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!22
Set of commits to be tagger v0.19
Pipeline
#136204
passed
11 months ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
recipes/Dockerfile.pasteurjanelia
+1
-1
1 addition, 1 deletion
recipes/Dockerfile.pasteurjanelia
scripts/install.sh
+57
-26
57 additions, 26 deletions
scripts/install.sh
scripts/larvatagger.sh
+18
-7
18 additions, 7 deletions
scripts/larvatagger.sh
with
76 additions
and
34 deletions
recipes/Dockerfile.pasteurjanelia
+
1
−
1
View file @
9ae6a5b9
...
...
@@ -9,7 +9,7 @@ ENV PIP_DISABLE_PIP_VERSION_CHECK=1 \
RUN apt-get update \
&& apt-get install --no-install-recommends -y make wget unzip \
&& if ! command -v poetry; then \
&& if ! command -v poetry
&>/dev/null
; then \
apt-get install --no-install-recommends -y python3-dev python3-pip \
&& pip install "poetry==$POETRY_VERSION"; \
fi \
...
...
This diff is collapsed.
Click to expand it.
scripts/install.sh
+
57
−
26
View file @
9ae6a5b9
...
...
@@ -4,9 +4,13 @@
if
[
-z
"
$BIN_DIR
"
]
;
then
BIN_DIR
=
~/.local/bin
else
echo
"Using environment variable: BIN_DIR=
$BIN_DIR
"
fi
if
[
-z
"
$LARVATAGGER_PATH
"
]
;
then
LARVATAGGER_PATH
=
~/.local/share/larvatagger
else
echo
"Using environment variable: LARVATAGGER_PATH=
$LARVATAGGER_PATH
"
fi
if
[
"
$1
"
=
"--uninstall"
]
;
then
...
...
@@ -21,52 +25,62 @@ if [ "$1" = "--uninstall" ]; then
else
PYTHON_VERSION
=
3.8
# the internal_<VAR> variables need to be set non-empty only if
# the corresponding <VAR> variable is non-empty; they are used to
# determine whether or not to report externally sourced variables
internal_WITH_BACKEND
=
internal_MAGGOTUBA_ADAPTER_BRANCH
=
for
arg
in
"
$@
"
;
do
if
[
"
$arg
"
=
"--with-default-backend"
]
;
then
WITH_BACKEND
=
1
internal_WITH_BACKEND
=
1
MAGGOTUBA_CORE_BRANCH
=
MAGGOTUBA_ADAPTER_BRANCH
=
break
elif
[
"
$arg
"
=
"--with-backend"
]
;
then
WITH_BACKEND
=
1
internal_WITH_BACKEND
=
1
elif
[
"
$arg
"
=
"--experimental"
]
;
then
MAGGOTUBA_CORE_BRANCH
=
MAGGOTUBA_ADAPTER_BRANCH
=
torch2
internal_MAGGOTUBA_ADAPTER_BRANCH
=
1
PYTHON_VERSION
=
3.11
fi
done
if
!
command
-v
curl
>
/dev/null
;
then
if
command
-v
brew
>
/dev/null
;
then
if
!
command
-v
curl
&
>/dev/null
;
then
if
command
-v
brew
&
>/dev/null
;
then
# macOS users are not given the choice as they usually do not care about freedom
brew
install
curl
fi
fi
if
!
command
-v
curl
>
/dev/null
;
then
if
!
command
-v
curl
&
>/dev/null
;
then
echo
"Command curl required; aborting"
else
check_brew
()
{
if
[
"
`
uname
`
"
=
"Darwin"
]
;
then
# macOS
if
!
command
-v
brew
>
/dev/null
;
then
if
!
command
-v
brew
&
>/dev/null
;
then
echo
"Installing Homebrew; admin rights will be requested"
/bin/bash
-c
"
$(
curl
-fsSL
https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh
)
"
fi
fi
}
if
!
command
-v
realpath
>
/dev/null
;
then
if
!
command
-v
realpath
&
>/dev/null
;
then
# macOS
check_brew
if
command
-v
brew
>
/dev/null
;
then
if
command
-v
brew
&
>/dev/null
;
then
brew
install
coreutils
fi
fi
if
!
command
-v
julia
>
/dev/null
;
then
if
!
command
-v
julia
&
>/dev/null
;
then
if
[
-z
"
$JULIA_INSTALL_ARGS
"
]
;
then
JULIA_INSTALL_ARGS
=
-y
else
echo
"Using environment variable: JULIA_INSTALL_ARGS=
$JULIA_INSTALL_ARGS
"
fi
curl
-fsSL
https://install.julialang.org | sh
-s
--
$JULIA_INSTALL_ARGS
if
[
-f
~/.bashrc
]
;
then
...
...
@@ -80,8 +94,8 @@ if [ -n "$WITH_BACKEND" ]; then
if
[
"
`
uname
`
"
=
"Darwin"
]
;
then
echo
"WARNING: the default tagging backend is not supported by macOS"
fi
if
!
command
-v
python
$PYTHON_VERSION
>
/dev/null
;
then
if
command
-v
pyenv
>
/dev/null
;
then
if
!
command
-v
python
$PYTHON_VERSION
&
>/dev/null
;
then
if
command
-v
pyenv
&
>/dev/null
;
then
[
`
pyenv versions |
grep
$PYTHON_VERSION
`
]
||
pyenv
install
$PYTHON_VERSION
elif
[[
"
`
uname
-r
`
"
=
~
"-microsoft-standard-WSL2"
]]
;
then
echo
...
...
@@ -96,21 +110,21 @@ if [ -n "$WITH_BACKEND" ]; then
eval
"
$(
~/.pyenv/bin/pyenv init -
)
"
cat
<<
"
EOF
" >>~/.bashrc
command -v pyenv >/dev/null || export PATH=~/.pyenv/bin:
$PATH
command -v pyenv
&
>/dev/null || export PATH=~/.pyenv/bin:
$PATH
eval "
$(
~/.pyenv/bin/pyenv init -
)
"
EOF
pyenv
install
$PYTHON_VERSION
else
check_brew
if
command
-v
brew
>
/dev/null
;
then
if
command
-v
brew
&
>/dev/null
;
then
brew
install
python@
$PYTHON_VERSION
else
echo
"WARNING: command python
$PYTHON_VERSION
not found"
fi
fi
fi
if
!
command
-v
poetry
>
/dev/null
;
then
if
command
-v
pipx
>
/dev/null
;
then
if
!
command
-v
poetry
&
>/dev/null
;
then
if
command
-v
pipx
&
>/dev/null
;
then
pipx
install
poetry
else
curl
-fsSL
https://install.python-poetry.org | python3 -
...
...
@@ -127,6 +141,7 @@ else
if
[
-z
"
$PLANARLARVAE_BRANCH
"
]
;
then
PLANARLARVAE_BRANCH
=
main
else
echo
"Using environment variable: PLANARLARVAE_BRANCH=
$PLANARLARVAE_BRANCH
"
curl
-fsSL
https://gitlab.pasteur.fr/nyx/planarlarvae.jl/-/archive/
${
PLANARLARVAE_BRANCH
}
/planarlarvae.jl-
${
PLANARLARVAE_BRANCH
}
.tar.gz |
tar
zxv
mv
planarlarvae.jl-
${
PLANARLARVAE_BRANCH
}
PlanarLarvae
fi
...
...
@@ -137,6 +152,8 @@ if [ -d LarvaTagger.jl ]; then
else
if
[
-z
"
$LARVATAGGER_BRANCH
"
]
;
then
LARVATAGGER_BRANCH
=
dev
else
echo
"Using environment variable: LARVATAGGER_BRANCH=
$LARVATAGGER_BRANCH
"
fi
curl
-fsSL
https://gitlab.pasteur.fr/nyx/larvatagger.jl/-/archive/
${
LARVATAGGER_BRANCH
}
/larvatagger.jl-
${
LARVATAGGER_BRANCH
}
.tar.gz |
tar
zxv
mv
larvatagger.jl-
${
LARVATAGGER_BRANCH
}
LarvaTagger.jl
...
...
@@ -155,9 +172,11 @@ EOF
else
[
-z
"
$internal_WITH_BACKEND
"
]
&&
echo
"Using environment variable: WITH_BACKEND=
$WITH_BACKEND
"
activate
()
{
# pyenv activation is necessary on WSL
command
-v
pyenv
>
/dev/null
&&
pyenv
local
$PYTHON_VERSION
command
-v
pyenv
&
>/dev/null
&&
pyenv
local
$PYTHON_VERSION
poetry
env
use
$PYTHON_VERSION
}
...
...
@@ -166,6 +185,8 @@ if [ -d TaggingBackends ]; then
else
if
[
-z
"
$TAGGINGBACKENDS_BRANCH
"
]
;
then
TAGGINGBACKENDS_BRANCH
=
main
else
echo
"Using environment variable: TAGGINGBACKENDS_BRANCH=
$TAGGINGBACKENDS_BRANCH
"
fi
curl
-fsSL
https://gitlab.pasteur.fr/nyx/TaggingBackends/-/archive/
${
TAGGINGBACKENDS_BRANCH
}
/TaggingBackends-
${
TAGGINGBACKENDS_BRANCH
}
.tar.gz |
tar
zxv
mv
TaggingBackends-
${
TAGGINGBACKENDS_BRANCH
}
TaggingBackends
...
...
@@ -180,6 +201,7 @@ else
if
[
-z
"
$MAGGOTUBA_CORE_BRANCH
"
]
;
then
MAGGOTUBA_CORE_BRANCH
=
main
else
echo
"Using environment variable: MAGGOTUBA_CORE_BRANCH=
$MAGGOTUBA_CORE_BRANCH
"
curl
-fsSL
https://gitlab.pasteur.fr/nyx/maggotuba-core/-/archive/
${
MAGGOTUBA_CORE_BRANCH
}
/maggotuba-core-
${
MAGGOTUBA_CORE_BRANCH
}
.tar.gz |
tar
zxv
mv
maggotuba-core-
${
MAGGOTUBA_CORE_BRANCH
}
MaggotUBA-core
fi
...
...
@@ -190,6 +212,8 @@ if [ -d MaggotUBA ]; then
else
if
[
-z
"
$MAGGOTUBA_ADAPTER_BRANCH
"
]
;
then
MAGGOTUBA_ADAPTER_BRANCH
=
main
elif
[
-z
"
$internal_MAGGOTUBA_ADAPTER_BRANCH
"
]
;
then
echo
"Using environment variable: MAGGOTUBA_ADAPTER_BRANCH=
$MAGGOTUBA_ADAPTER_BRANCH
"
fi
curl
-fsSL
https://gitlab.pasteur.fr/nyx/MaggotUBA-adapter/-/archive/
${
MAGGOTUBA_ADAPTER_BRANCH
}
/MaggotUBA-adapter-
${
MAGGOTUBA_ADAPTER_BRANCH
}
.tar.gz |
tar
zxv
mv
MaggotUBA-adapter-
${
MAGGOTUBA_ADAPTER_BRANCH
}
MaggotUBA
#-adapter
...
...
@@ -213,22 +237,29 @@ fi
chmod
a+x
"
$BIN_DIR
/larvatagger"
if
!
command
-v
larvatagger
>
/dev/null
;
then
# ~/.local/bin not in $PATH?
if
[
"
$SHELL
"
=
"/bin/zsh"
]
;
then
rcfile
=
~/.zshrc
elif
[
"
$SHELL
"
=
"/bin/bash"
]
;
then
if
[
-f
~/.bashrc
]
;
then
rcfile
=
~/.bashrc
elif
[
-f
~/.bash_profile
]
;
then
rcfile
=
~/.bash_profile
if
!
command
-v
larvatagger &>/dev/null
;
then
if
[
"
`
realpath
$BIN_DIR
`
"
=
"
`
realpath
~/.local/bin
`
"
]
;
then
# ~/.local/bin not in $PATH?
if
[
"
$SHELL
"
=
"/bin/zsh"
]
;
then
rcfile
=
~/.zshrc
elif
[
"
$SHELL
"
=
"/bin/bash"
]
;
then
if
[
-f
~/.bashrc
]
;
then
rcfile
=
~/.bashrc
elif
[
-f
~/.bash_profile
]
;
then
rcfile
=
~/.bash_profile
fi
fi
fi
cat
<<
"
EOF
" >>
$rcfile
echo
"Extending the PATH environment variable in
$rcfile
"
cat
<<
"
EOF
" >>
$rcfile
export PATH=
$PATH
:~/.local/bin
EOF
export
PATH
=
$PATH
:~/.local/bin
else
echo
"the larvatagger command is available in directory:"
echo
"
$BIN_DIR
"
echo
"consider adding the directory to the PATH variable"
fi
export
PATH
=
$PATH
:
$BIN_DIR
fi
##
...
...
This diff is collapsed.
Click to expand it.
scripts/larvatagger.sh
+
18
−
7
View file @
9ae6a5b9
...
...
@@ -45,14 +45,15 @@ if [ -z "$without_rm" ]; then
fi
if
[
-z
"
$docker
"
]
;
then
if
docker
--version
&> /dev/null
;
then
docker
=
docker
else
docker
=
docker
if
command
-v
podman &> /dev/null
;
then
docker
=
podman
if
[
"
$cmd
"
!=
"build"
]
;
then
DOCKER_ARGS
=
"
${
DOCKER_ARGS
}
--security-opt label=disable "
fi
fi
else
echo
"Using environment variable: docker=
$docker
"
fi
if
[
-z
"
$LARVATAGGER_IMAGE
"
]
;
then
...
...
@@ -61,6 +62,8 @@ LARVATAGGER_IMAGE=larvatagger
else
LARVATAGGER_IMAGE
=
flaur/larvatagger
fi
else
echo
"Using environment variable: LARVATAGGER_IMAGE=
$LARVATAGGER_IMAGE
"
fi
HOST_UID
=
$(
id
-u
$USER
)
...
...
@@ -104,7 +107,10 @@ DOCKER_ARGS="--target $TARGET $DOCKER_ARGS"
fi
if
[
-z
"
$DOCKERFILE
"
]
;
then
DOCKERFILE
=
recipes/Dockerfile
else
echo
"Using environment variable DOCKERFILE=
$DOCKERFILE
"
fi
DOCKER_ARGS
=
"-f
\"
$DOCKERFILE
\"
$DOCKER_ARGS
"
if
[
"
$BUILD
"
==
"--dev"
]
;
then
if
!
[[
"
$LARVATAGGER_IMAGE
"
==
*
:
*
]]
;
then
LARVATAGGER_IMAGE
=
"
${
LARVATAGGER_IMAGE
}
:dev"
;
fi
PROJECT_ROOT
=
$(
basename
$(
pwd
))
...
...
@@ -112,7 +118,7 @@ cd ..
DOCKER_BUILDKIT
=
1
$docker
build
-t
"
$LARVATAGGER_IMAGE
"
-f
"
$PROJECT_ROOT
/recipes/Dockerfile.local"
${
DOCKER_ARGS
}
.
elif
[
"
$BUILD
"
==
"--stable"
]
;
then
if
!
[[
"
$LARVATAGGER_IMAGE
"
==
*
:
*
]]
;
then
LARVATAGGER_IMAGE
=
"
${
LARVATAGGER_IMAGE
}
:stable"
;
fi
$docker
build
-t
"
$LARVATAGGER_IMAGE
"
-f
recipes/Dockerfile
${
DOCKER_ARGS
}
.
$docker
build
-t
"
$LARVATAGGER_IMAGE
"
${
DOCKER_ARGS
}
.
else
if
!
[[
"
$LARVATAGGER_IMAGE
"
==
*
:
*
]]
;
then
LARVATAGGER_IMAGE
=
"
${
LARVATAGGER_IMAGE
}
:latest"
;
fi
if
[
-z
"
$LARVATAGGER_BRANCH
"
]
;
then
...
...
@@ -122,12 +128,16 @@ if [ -z "$LARVATAGGER_BRANCH" ]; then
echo
"Deprecation notice: LARVATAGGER_DEFAULT_BRANCH has been renamed LARVATAGGER_BRANCH"
LARVATAGGER_BRANCH
=
$LARVATAGGER_DEFAULT_BRANCH
fi
else
echo
"Using environment variable: LARVATAGGER_BRANCH=
$LARVATAGGER_BRANCH
"
fi
if
[
-z
"
$TAGGINGBACKENDS_BRANCH
"
]
;
then
TAGGINGBACKENDS_BRANCH
=
$LARVATAGGER_BRANCH
else
echo
"Using environment variable: TAGGINGBACKENDS_BRANCH=
$TAGGINGBACKENDS_BRANCH
"
fi
DOCKER_ARGS
=
"--build-arg TAGGINGBACKENDS_BRANCH=
$TAGGINGBACKENDS_BRANCH
$DOCKER_ARGS
"
$docker
build
-t
"
$LARVATAGGER_IMAGE
"
-f
$DOCKERFILE
${
DOCKER_ARGS
}
--build-arg
BRANCH
=
$LARVATAGGER_BRANCH
.
$docker
build
-t
"
$LARVATAGGER_IMAGE
"
${
DOCKER_ARGS
}
--build-arg
BRANCH
=
$LARVATAGGER_BRANCH
.
fi
;;
...
...
@@ -137,6 +147,7 @@ if [ -z "$LARVATAGGER_PORT" -o "$LARVATAGGER_PORT" == "9284" ]; then
DOCKER_ARGS
=
"-p 9284:9284
$DOCKER_ARGS
"
TAGGER_ARGS
=
else
echo
"Using environment variable: LARVATAGGER_PORT=
$LARVATAGGER_PORT
"
DOCKER_ARGS
=
"-p
$LARVATAGGER_PORT
:
$LARVATAGGER_PORT
$DOCKER_ARGS
"
TAGGER_ARGS
=
"--port=
$LARVATAGGER_PORT
"
fi
...
...
@@ -150,7 +161,7 @@ RUN_ARGS="$RUN_ARGS -v \"$parentdir\":/data"
backend
=
MaggotUBA
while
[
-n
"
$1
"
-a
"
$1
"
=
"--external-instance"
]
;
do
instance
=
$2
;
shift
2
if
[
-z
"
$(
which
realpath
)
"
]
;
then
if
!
command
-v
realpath
&>/dev/null
;
then
echo
"realpath: command not found"
echo
"on macOS: brew install coreutils"
exit
1
...
...
@@ -269,7 +280,7 @@ fi
done
if
[
-n
"
$tagger_path
"
]
;
then
if
[
-z
"
$(
which
realpath
)
"
]
;
then
if
!
command
-v
realpath
&>/dev/null
;
then
echo
"realpath: command not found"
echo
"on macOS: brew install coreutils"
exit
1
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment