about summary refs log tree commit diff
path: root/scripts/prepare-julia-depot.sh
blob: 0e7b2d9e3dd77c6d4e7f30a30536d6f310c7cfe7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env bash
# Prepare the Julia depot BulkLMM needs, once, deliberately.
#
# The depot is small on purpose (79 packages, ~140 MB: CSV, DataFrames,
# Distributions, Optim and their dependencies -- no GPU/CUDA stack). Requests
# run with JULIA_PKG_OFFLINE=true, so a scan never downloads anything; this
# script is the only thing that does, and only when run by hand.
#
#   scripts/prepare-julia-depot.sh /path/to/depot /path/to/project
#
# The project must carry the pinned Manifest.toml (see docs/bulklmm.md); the
# deployment's copy lives in factory/gn4-julia-env.
set -euo pipefail

DEPOT="${1:-$HOME/.julia}"
PROJECT="${2:-$(cd "$(dirname "$0")/.." && pwd)/../gn4-julia-env}"
JULIA="${JULIA:-julia}"

[ -f "$PROJECT/Manifest.toml" ] || {
    echo "$PROJECT: no Manifest.toml -- the depot must be built from a pinned project" >&2
    exit 1
}

echo "depot:   $DEPOT"
echo "project: $PROJECT"
echo "julia:   $("$JULIA" --version)"

JULIA_DEPOT_PATH="$DEPOT" "$JULIA" --startup-file=no --project="$PROJECT" -e '
    using Pkg
    Pkg.instantiate()
    Pkg.precompile()
    println("depot ready: ", length(readdir(joinpath(DEPOT, "packages"))), " packages")
'
echo
echo "Point the API at it:  BULKLMM_DEPOT=$DEPOT BULKLMM_ENV=$PROJECT"