diff --git a/Project.toml b/Project.toml index 492c4be584ceb11bfbbf6c8adbd5a1275249f6fc..f97ce637e06839bdd93d71e1e4cebf9b6f2138d4 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 17a2fff508a673f3e6cbf2e213e7e6ff65cec9fd..47979460b227ff0358dc294d5ffdff33912c5268 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 a3926b81340a76110d3bb0f21e9f6c7cf1ec7721..5d033139a6a0d0f2e682adac54fd69786a886cac 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 8739258c75d3b4368eb9c28399aabfd7c5b36251..581f914d797747865d66f3f5395eeba758077b6a 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 1a98b6c912c8313f9149ca5ddcb7c91ace24e64a..2e60a80b9babbf0ceab86cefbd94cc9294b4691f 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