From a4e74272f904dce191e6b36b6ec15f47bd5a227e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Laurent?= <francois.laurent@posteo.net>
Date: Wed, 26 Oct 2022 16:00:07 +0200
Subject: [PATCH] version increment

---
 Project.toml             |  2 +-
 README.md                | 14 +++++++-------
 recipes/Dockerfile.local | 13 ++++++++++++-
 scripts/larvatagger.sh   |  9 +++++++++
 src/Taggers.jl           |  2 +-
 5 files changed, 30 insertions(+), 10 deletions(-)

diff --git a/Project.toml b/Project.toml
index 492c4be..f97ce63 100644
--- a/Project.toml
+++ b/Project.toml
@@ -1,7 +1,7 @@
 name = "LarvaTagger"
 uuid = "8b3b36f1-dfed-446e-8561-ea19fe966a4d"
 authors = ["François Laurent", "Institut Pasteur"]
-version = "0.5.0"
+version = "0.6.0"
 
 [deps]
 Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
diff --git a/README.md b/README.md
index 17a2fff..4797946 100644
--- a/README.md
+++ b/README.md
@@ -15,10 +15,10 @@ Alternatively, if you have Docker installed, take a look at the [dedicated instr
 ```
 git clone https://gitlab.pasteur.fr/nyx/larvatagger.jl LarvaTagger
 cd LarvaTagger
-julia --project -e 'using Pkg; Pkg.instantiate()'
+julia --project=. -e 'using Pkg; Pkg.instantiate()'
 ```
 
-Calling `instantiate` in a copy of the project is preferred to using `Pkg.add`,
+Calling `Pkg.instantiate` in a copy of the project is preferred over using `Pkg.add`,
 because `LarvaTagger.jl` depends on several unregistered packages.
 
 Users who would prefer not to clone the repository or implicitly use the shipped `Manifest.toml` file
@@ -27,7 +27,7 @@ can follow the following steps instead:
 ```
 mkdir LarvaTagger
 cd LarvaTagger
-julia --project -q
+julia --project=. -q
 julia>
 (LarvaTagger) pkg> add https://gitlab.pasteur.fr/nyx/PlanarLarvae.jl
 (LarvaTagger) pkg> add https://gitlab.com/dbc-nyx/ObservationPolicies.jl
@@ -41,7 +41,7 @@ julia>
 
 In the `LarvaTagger` directory created above, launch the Julia interpreter:
 ```
-julia --project
+julia --project=.
 ```
 In the interpreter, to launch the editor, type:
 ```
@@ -64,7 +64,7 @@ The script will also launch a Julia interpreter, and give extra guidance on *e.g
 
 ## Automatic tagging
 
-To extend the editor with `MaggotUBA` automatic tagging, checkout out the [recommanded installation steps for TaggingBackends and MaggotUBA](https://gitlab.pasteur.fr/nyx/TaggingBackends#recommanded-installation-and-troubleshooting).
+To extend the editor with `MaggotUBA` automatic tagging, checkout out the [recommended installation steps for TaggingBackends and MaggotUBA](https://gitlab.pasteur.fr/nyx/TaggingBackends#recommended-installation).
 
 If the backend directory is created right in the `LarvaTagger` directory, `LarvaTagger.jl` will automatically find it.
 
@@ -78,11 +78,11 @@ Similarly, to let *larvatagger.jl* know about MaggotUBA:
 scripts/larvatagger.jl open <path/to/data/file> --backends=<path/to/MaggotUBA's/parent/directory> --browser
 ```
 
-The larvatagger.jl script can be used to proceed with training a new tagger:
+The larvatagger.jl script can also be used to train a new tagger:
 ```
 scripts/larvatagger.jl train <path/to/backend> <path/to/data/repository> <tagger-name>
 ```
-and applying a tagger to a tracking data file:
+and apply this tagger to a tracking data file:
 ```
 scripts/larvatagger.jl predict <path/to/backend> <tagger-name> <path/to/data/file> --skip-make-dataset
 ```
diff --git a/recipes/Dockerfile.local b/recipes/Dockerfile.local
index a3926b8..5d03313 100644
--- a/recipes/Dockerfile.local
+++ b/recipes/Dockerfile.local
@@ -1,14 +1,25 @@
+# To be built with scripts/larvatagger.sh build --dev
+
 FROM julia:1.8.2-bullseye
 
 ENV JULIA_PROJECT=/app/TaggingBackends
 ENV JULIA_DEPOT_PATH=/usr/local/share/julia
 ENV POETRY_VIRTUALENVS_PATH=/usr/local/share/poetry
 
+# We assume:
+# * current directory name is LarvaTagger; contains the LarvaTagger.jl project;
+# * PlanarLarvae.jl project is available as sibling directory PlanarLarvae;
+# * TaggingBackends project is available as sibling directory TaggingBackends;
+# * MaggotUBA-core project is available as sibling directory MaggotUBA-core;
+# * MaggotUBA-adapter project is available as sibling directory MaggotUBA-adapter.
+# Paths are given relative to parent directory, since larvatagger.sh will move 1 level up
+# prior to calling docker build
+
 ARG PLANARLARVAE=./PlanarLarvae
 ARG LARVATAGGER=./LarvaTagger
 ARG TAGGINGBACKENDS=./TaggingBackends
 ARG MAGGOTUBA_CORE=./MaggotUBA-core
-ARG MAGGOTUBA_ADAPTER=./maggot
+ARG MAGGOTUBA_ADAPTER=./MaggotUBA-adapter
 
 COPY $PLANARLARVAE/src /app/PlanarLarvae/src
 COPY $PLANARLARVAE/Project.toml $PLANARLARVAE/Manifest.toml /app/PlanarLarvae/
diff --git a/scripts/larvatagger.sh b/scripts/larvatagger.sh
index 8739258..581f914 100755
--- a/scripts/larvatagger.sh
+++ b/scripts/larvatagger.sh
@@ -58,7 +58,16 @@ else
 DOCKER_ARGS="-p $LARVATAGGER_PORT:$LARVATAGGER_PORT"
 TAGGER_ARGS="--port=$LARVATAGGER_PORT"
 fi
+
 file=$1; shift
+
+# undocumented feature
+backend=MaggotUBA
+while [ -n "$1" -a "$1" = "--external-instance" ]; do
+instance=$2; shift 2
+RUN_ARGS="$RUN_ARGS --mount type=bind,src=$(realpath $instance),dst=/app/$backend/models/$(basename $instance)"
+done
+
 exec docker run $RUN_ARGS -i $DOCKER_ARGS "$LARVATAGGER_IMAGE" open "/data/$file" $TAGGER_ARGS $@
 ;;
 
diff --git a/src/Taggers.jl b/src/Taggers.jl
index 1a98b6c..2e60a80 100644
--- a/src/Taggers.jl
+++ b/src/Taggers.jl
@@ -117,7 +117,7 @@ so that the actual user is known.
 function check_permissions(file)
     try
         uid, gid = ENV["HOST_UID"], ENV["HOST_GID"]
-        @info "Changing file ownership" uid gid file
+        @debug "Changing file ownership" uid gid file
         chown(file, parse(Int, uid), parse(Int, gid))
     catch
     end
-- 
GitLab