devzone 0.44.0 → 0.45.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,171 @@
1
+ #!/usr/bin/env bash
2
+ # devzone llm bench (#593), sourced by llm.sh (uses its NS, k, preset_read
3
+ # and refuse): llama-bench of the model in a Kubernetes Job of the
4
+ # namespace devzone-llm (image full-<llamaBuild> of the chart, same build as the
5
+ # server, pulled only here), then a table, a threads recommendation and whether
6
+ # the speed is enough for opencode.
7
+ # devzone llm bench [--apply] [--threads LIST] [--prompt N] [--gen N]
8
+ # --apply sets threads=<best> on the release llm (helm upgrade, values kept).
9
+ # Env: LLM_BENCH_ATTENTE (seconds, 1800: wait limit and activeDeadlineSeconds of
10
+ # the Job, which stops by itself if the call is interrupted), LLM_BENCH_POLL
11
+ # (seconds, 5), LLM_BENCH_SIGNE (seconds, 30: a progress line at least this
12
+ # often, so that the connection of kubectl exec is not cut), LLM_BENCH_MIN_PP (50 tok/s, prompt reading), LLM_BENCH_MIN_TG (8 tok/s,
13
+ # generation). The Job is deleted at the end, even on failure. bash 3.2 (macOS).
14
+
15
+ BENCH_JOB=llm-bench
16
+
17
+ # Server present, read with the rights of the namespace (the account of the pod
18
+ # cannot read a namespace, a cluster resource: installed would fail for it)
19
+ bench_present() { k get deployment llm >/dev/null 2>&1; }
20
+
21
+ # Job deleted (no error when it is already gone)
22
+ bench_cleanup() { k delete job "$BENCH_JOB" --ignore-not-found --wait=false >/dev/null 2>&1 || true; }
23
+
24
+ # Phase of the Job for the progress line, read from the state of the container
25
+ # (not the phase of the pod): waiting (ContainerCreating, PullImage...) is
26
+ # pulling, running or terminated is measuring. The caller keeps the phase
27
+ # monotone: once measuring, it never goes back to pulling.
28
+ bench_phase() {
29
+ local etat
30
+ etat="$(k get pods -l app=llm-bench -o jsonpath='{.items[0].status.containerStatuses[0].state.running.startedAt}|{.items[0].status.containerStatuses[0].state.terminated.reason}' 2>/dev/null || true)"
31
+ case "$etat" in
32
+ "|" | "") echo "pulling the image" ;;
33
+ *) echo "measuring" ;;
34
+ esac
35
+ }
36
+
37
+ # Waits for the Job: 0 done, 1 failed, 2 timeout. Writes a line (phase,
38
+ # elapsed time) at least every LLM_BENCH_SIGNE seconds
39
+ bench_wait() {
40
+ local waited=0 poll="${LLM_BENCH_POLL:-5}" limit="${LLM_BENCH_ATTENTE:-1800}" beat="${LLM_BENCH_SIGNE:-30}" st last="" phase="pulling the image"
41
+ while [ "$waited" -lt "$limit" ]; do
42
+ st="$(k get job "$BENCH_JOB" -o jsonpath='{.status.succeeded}/{.status.failed}' 2>/dev/null || true)"
43
+ case "$st" in
44
+ 1/*) return 0 ;;
45
+ */[1-9]*) return 1 ;;
46
+ esac
47
+ if [ -z "$last" ] || [ $((waited - last)) -ge "$beat" ]; then
48
+ # Monotone: once measuring, the phase is not read again
49
+ [ "$phase" = measuring ] || phase="$(bench_phase)"
50
+ echo " … $phase, ${waited}s elapsed"
51
+ last=$waited
52
+ fi
53
+ sleep "$poll"
54
+ waited=$((waited + poll))
55
+ done
56
+ return 2
57
+ }
58
+
59
+ # Table "threads pp tg" (tok/s) from the JSON of llama-bench (logs of the Job:
60
+ # the array is the part between the line "[" and the line "]")
61
+ bench_rows() {
62
+ sed -n '/^\[/,/^\]/p' | jq -r '
63
+ group_by(.n_threads)[]
64
+ | [.[0].n_threads,
65
+ (map(select(.n_prompt > 0 and .n_gen == 0)) | .[0].avg_ts // 0),
66
+ (map(select(.n_gen > 0 and .n_prompt == 0)) | .[0].avg_ts // 0)]
67
+ | @tsv' 2>/dev/null
68
+ }
69
+
70
+ # Best row (generation speed, then fewer threads) and the verdict, from the
71
+ # rows on stdin: prints the table then "best=<n>" and "ok=0|1"
72
+ bench_report() {
73
+ awk -v mpp="${LLM_BENCH_MIN_PP:-50}" -v mtg="${LLM_BENCH_MIN_TG:-8}" '
74
+ { t[NR] = $1; pp[NR] = $2; tg[NR] = $3 }
75
+ END {
76
+ printf "%-8s %-22s %s\n", "threads", "prompt (tok/s)", "generation (tok/s)"
77
+ b = 0
78
+ for (i = 1; i <= NR; i++) {
79
+ printf "%-8s %-22.1f %.1f\n", t[i], pp[i], tg[i]
80
+ if (b == 0 || tg[i] > tg[b] || (tg[i] == tg[b] && t[i] + 0 < t[b] + 0)) b = i
81
+ }
82
+ if (b == 0) exit 1
83
+ print "best=" t[b]
84
+ print "ok=" ((pp[b] >= mpp && tg[b] >= mtg) ? 1 : 0)
85
+ }'
86
+ }
87
+
88
+ # Commands proposed to the user, by place: the Kubernetes workspace runs the
89
+ # bench through devzone workspace services (DEVZONE_SERVICES_ADMIN, set by
90
+ # services-admin.sh); the Docker container keeps devzone llm
91
+ bench_cmds() {
92
+ if [ -n "${DEVZONE_SERVICES_ADMIN:-}" ]; then
93
+ CMD_APPLY="devzone workspace services bench llm --apply"
94
+ CMD_LIGHT="devzone workspace services disable llm && devzone workspace services enable llm --preset light"
95
+ else
96
+ CMD_APPLY="devzone llm bench --apply"
97
+ CMD_LIGHT="devzone disable llm && devzone enable llm --preset light"
98
+ fi
99
+ }
100
+
101
+ bench_apply() {
102
+ helm --kube-context devzone upgrade llm "$CHART_CODE/charts/devzone-llm" -n "$NS" --reset-then-reuse-values --set "threads=$1" >/dev/null || return 1
103
+ wait_ready
104
+ }
105
+
106
+ bench() {
107
+ local apply="" want="" arg threads="" prompt="" gen="" sets logs rows report best ok
108
+ local -a args
109
+ for arg in "$@"; do
110
+ if [ -n "$want" ]; then
111
+ case "$want" in
112
+ threads) threads="$arg" ;;
113
+ prompt) prompt="$arg" ;;
114
+ gen) gen="$arg" ;;
115
+ esac
116
+ want=""
117
+ continue
118
+ fi
119
+ case "$arg" in
120
+ --apply) apply=1 ;;
121
+ --threads | --prompt | --gen) want="${arg#--}" ;;
122
+ *) refuse "unknown argument: $arg (devzone llm bench [--apply] [--threads 4,8] [--prompt 128] [--gen 32])" ;;
123
+ esac
124
+ done
125
+ [ -z "$want" ] || refuse "--$want needs a value"
126
+ # In the pod only devzone workspace services (DEVZONE_SERVICES_ADMIN) has rights on the namespace
127
+ if [ "${DEVZONE_WORKSPACE:-}" = kubernetes ] && [ -z "${DEVZONE_SERVICES_ADMIN:-}" ]; then
128
+ echo "devzone: llm bench runs from your computer: devzone workspace services bench llm" >&2
129
+ exit 2
130
+ fi
131
+ bench_present || refuse "bench: the module is not enabled (devzone enable llm)"
132
+ sets="$(llm_preset_sets "$(preset_read)") bench.enabled=true"
133
+ [ -z "$threads" ] || sets="$sets bench.threads=${threads//,/\\,}" # helm --set: a comma separates keys
134
+ [ -z "$prompt" ] || sets="$sets bench.prompt=$prompt"
135
+ [ -z "$gen" ] || sets="$sets bench.gen=$gen"
136
+ sets="$sets bench.deadline=${LLM_BENCH_ATTENTE:-1800}"
137
+ args=()
138
+ for arg in $sets; do args+=(--set "$arg"); done
139
+ trap bench_cleanup EXIT INT TERM
140
+ bench_cleanup
141
+ echo "▶ llama-bench in the namespace $NS (image full-<build>: larger than the server image, pulled on first use; the server keeps running, so the numbers are a bit low)…"
142
+ helm template llm "$CHART_CODE/charts/devzone-llm" -n "$NS" "${args[@]}" --show-only templates/bench-job.yaml | k apply -f - >/dev/null || return 1
143
+ bench_wait || {
144
+ echo "devzone: llm: bench Job failed or timed out (LLM_BENCH_ATTENTE=${LLM_BENCH_ATTENTE:-1800}s): kubectl --context devzone -n $NS logs job/$BENCH_JOB" >&2
145
+ k logs "job/$BENCH_JOB" --tail=5 >&2 2>/dev/null || true
146
+ return 1
147
+ }
148
+ logs="$(k logs "job/$BENCH_JOB" 2>/dev/null || true)"
149
+ rows="$(printf '%s\n' "$logs" | bench_rows)"
150
+ [ -n "$rows" ] || { echo "devzone: llm: no llama-bench result in the logs of the Job" >&2; return 1; }
151
+ report="$(printf '%s\n' "$rows" | bench_report)"
152
+ printf '%s\n' "$report" | grep -v '^best=\|^ok='
153
+ best="$(printf '%s\n' "$report" | sed -n 's/^best=//p')"
154
+ ok="$(printf '%s\n' "$report" | sed -n 's/^ok=//p')"
155
+ echo "▶ Recommended: threads=$best"
156
+ bench_cmds
157
+ if [ "$ok" = 1 ]; then
158
+ echo "✔ Fast enough for opencode (prompt >= ${LLM_BENCH_MIN_PP:-50} tok/s, generation >= ${LLM_BENCH_MIN_TG:-8} tok/s)"
159
+ else
160
+ echo "⚠ Too slow for opencode (needs prompt >= ${LLM_BENCH_MIN_PP:-50} tok/s and generation >= ${LLM_BENCH_MIN_TG:-8} tok/s)"
161
+ if [ "$(preset_read)" != light ]; then
162
+ echo " Lighter model (3B, context 16k, 2.1 GB download): $CMD_LIGHT"
163
+ fi
164
+ fi
165
+ if [ -n "$apply" ]; then
166
+ bench_apply "$best" || return 1
167
+ echo "✔ threads=$best applied to the release llm"
168
+ else
169
+ echo " $CMD_APPLY sets threads=$best on the release"
170
+ fi
171
+ }
@@ -7,9 +7,9 @@
7
7
  # llm.sh preset [--preset P] preset stored for the next install (Argo CD path)
8
8
  # llm.sh apply on|off [...] what `devzone enable|disable llm` runs
9
9
  # llm.sh delete-data [--yes] namespace and volume removed (the model is downloaded again)
10
+ # llm.sh bench [--apply] llama-bench Job and threads recommendation (bench.sh)
10
11
  # First start = model download: LLM_ATTENTE (seconds, default 1800) is the wait.
11
- # The relay LLM_PORT (default 8089) reaches the service. The opencode provider is
12
- # opencode.sh. bash 3.2 (macOS).
12
+ # Relay LLM_PORT (default 8089); opencode provider: opencode.sh. bash 3.2 (macOS).
13
13
  set -euo pipefail
14
14
 
15
15
  ICI="$(cd "$(dirname "$0")" && pwd)"
@@ -28,6 +28,9 @@ ETAT="${DEVZONE_ETAT:-$RACINE/.devzone.modules}"
28
28
  # shellcheck source=SCRIPTDIR/presets.sh
29
29
  # shellcheck disable=SC1091
30
30
  . "$ICI/presets.sh"
31
+ # shellcheck source=SCRIPTDIR/bench.sh
32
+ # shellcheck disable=SC1091
33
+ . "$ICI/bench.sh"
31
34
 
32
35
  NS=devzone-llm
33
36
  STATE_DIR="$RACINE/workspace/.llm"
@@ -196,9 +199,7 @@ status() {
196
199
  relay_start() {
197
200
  local ctx
198
201
  ctx="$(cluster_lu)"
199
- if [ -n "$ctx" ] && installed; then
200
- relais_lancer llm "$ctx" "$NS" svc/llm "$LLM_PORT:8080"
201
- fi
202
+ [ -z "$ctx" ] || ! installed || relais_lancer llm "$ctx" "$NS" svc/llm "$LLM_PORT:8080"
202
203
  }
203
204
 
204
205
  # Writes llm=off in the state file (bad argument, no cluster)
@@ -241,10 +242,8 @@ case "${1:-}" in
241
242
  policy) policy ;;
242
243
  apply) apply "${@:2}" ;;
243
244
  delete-data) delete_data "${2:-}" ;;
245
+ bench) bench "${@:2}" ;;
244
246
  relay-start) relay_start ;;
245
247
  relay-stop) relais_arreter llm ;;
246
- *)
247
- echo "devzone llm: status | delete-data [--yes]" >&2
248
- exit 1
249
- ;;
248
+ *) echo "devzone llm: status | bench [--apply] | delete-data [--yes]" >&2; exit 1 ;;
250
249
  esac
@@ -3,6 +3,7 @@
3
3
  # the Kubernetes workspace pod, with a temporary administrator token (#528).
4
4
  # services-admin.sh enable|disable <service> [options of devzone enable]
5
5
  # services-admin.sh seed gitlab data of gitlab seeded again, in the pod (#538)
6
+ # services-admin.sh bench llm [options] speed of the model (#593)
6
7
  # Run by the workstation (manage/scripts/services-workspace.sh) through
7
8
  # kubectl exec -i: the token comes on stdin, is never printed and lives only
8
9
  # in a temporary kubeconfig removed at the end.
@@ -43,8 +44,8 @@ service="${2:-}"
43
44
  case "$action" in
44
45
  enable | activer) action=enable ;;
45
46
  disable | desactiver) action=disable ;;
46
- seed) ;;
47
- *) refuse "usage: services-admin.sh enable|disable|seed gitlab|postgres|argocd|llm [options]" ;;
47
+ seed | bench) ;;
48
+ *) refuse "usage: services-admin.sh enable|disable|seed|bench gitlab|postgres|argocd|llm [options]" ;;
48
49
  esac
49
50
  case "$service" in
50
51
  gitlab | postgres | argocd | llm) ;;
@@ -54,6 +55,9 @@ esac
54
55
  if [ "$action" = seed ] && [ "$service" != gitlab ]; then
55
56
  refuse "seed: only gitlab"
56
57
  fi
58
+ if [ "$action" = bench ] && [ "$service" != llm ]; then
59
+ refuse "bench: only llm"
60
+ fi
57
61
  [ "${DEVZONE_WORKSPACE:-}" = kubernetes ] || refuse "only in the Kubernetes workspace pod"
58
62
  [ -f "$SA_DIR/ca.crt" ] || refuse "cluster CA not found: $SA_DIR/ca.crt"
59
63
  if [ -t 0 ]; then
@@ -114,5 +118,6 @@ echo "devzone services: $action $service in the cluster of the pod (temporary ad
114
118
  case "$action" in
115
119
  # The seed is a module command: devzone gitlab seed (#538)
116
120
  seed) "$DEVZONE_CMD" gitlab seed "${@:3}" ;;
121
+ bench) "$DEVZONE_CMD" llm bench "${@:3}" ;;
117
122
  *) "$DEVZONE_CMD" "$action" "$service" "${@:3}" ;;
118
123
  esac
@@ -1,5 +1,5 @@
1
1
  # Single source for the repowarden version used by post-create.sh and workspace-init.sh.
2
- REPOWARDEN_VERSION=4.17.4
2
+ REPOWARDEN_VERSION=4.17.6
3
3
 
4
4
  # BuildKit client version installed in the workspace image (#514). Must match
5
5
  # buildkit.image in charts/devzone-workspace/values.yaml.
@@ -0,0 +1,65 @@
1
+ {{- if .Values.bench.enabled }}
2
+ # One-off llama-bench of the model (#593), never rendered by default. The
3
+ # volume is ReadWriteOnce: the pod must land on the node of the server pod.
4
+ apiVersion: batch/v1
5
+ kind: Job
6
+ metadata:
7
+ name: llm-bench
8
+ namespace: {{ .Release.Namespace }}
9
+ labels:
10
+ app: llm-bench
11
+ app.kubernetes.io/name: llm-bench
12
+ app.kubernetes.io/part-of: devzone
13
+ app.kubernetes.io/managed-by: devzone
14
+ spec:
15
+ backoffLimit: 0
16
+ activeDeadlineSeconds: {{ .Values.bench.deadline }}
17
+ ttlSecondsAfterFinished: {{ .Values.bench.ttl }}
18
+ template:
19
+ metadata:
20
+ labels:
21
+ app: llm-bench
22
+ app.kubernetes.io/managed-by: devzone
23
+ spec:
24
+ restartPolicy: Never
25
+ affinity:
26
+ podAffinity:
27
+ requiredDuringSchedulingIgnoredDuringExecution:
28
+ - topologyKey: kubernetes.io/hostname
29
+ labelSelector:
30
+ matchLabels:
31
+ app: llm
32
+ containers:
33
+ - name: bench
34
+ image: {{ .Values.image }}:full-{{ .Values.llamaBuild }}
35
+ command:
36
+ - /app/llama-bench
37
+ args:
38
+ - -m
39
+ - /models/{{ .Values.model.file }}
40
+ - -p
41
+ - {{ .Values.bench.prompt | quote }}
42
+ - -n
43
+ - {{ .Values.bench.gen | quote }}
44
+ - -r
45
+ - {{ .Values.bench.repetitions | quote }}
46
+ - -t
47
+ - {{ .Values.bench.threads | quote }}
48
+ - -o
49
+ - json
50
+ resources:
51
+ requests:
52
+ cpu: {{ .Values.resources.requests.cpu }}
53
+ memory: {{ .Values.memory }}
54
+ limits:
55
+ memory: {{ .Values.resources.limits.memory }}
56
+ volumeMounts:
57
+ - name: models
58
+ mountPath: /models
59
+ readOnly: true
60
+ volumes:
61
+ - name: models
62
+ persistentVolumeClaim:
63
+ claimName: {{ .Values.claim }}
64
+ readOnly: true
65
+ {{- end }}
@@ -54,7 +54,25 @@ spec:
54
54
  mountPath: /models
55
55
  containers:
56
56
  - name: llm
57
- image: {{ .Values.image }}
57
+ image: {{ .Values.image }}:server-{{ .Values.llamaBuild }}
58
+ env:
59
+ - name: THREADS
60
+ value: {{ .Values.threads | quote }}
61
+ - name: MAX_THREADS
62
+ value: {{ .Values.maxThreads | quote }}
63
+ command:
64
+ - sh
65
+ - -c
66
+ - |
67
+ set -eu
68
+ t="$THREADS"
69
+ if [ "$t" = auto ]; then
70
+ t="$(nproc)"
71
+ [ "$t" -le "$MAX_THREADS" ] || t="$MAX_THREADS"
72
+ fi
73
+ echo "llama-server: $t threads"
74
+ exec /app/llama-server "$@" -t "$t" --threads-batch "$t"
75
+ - llama-server
58
76
  args:
59
77
  - --host
60
78
  - 0.0.0.0
@@ -70,8 +88,6 @@ spec:
70
88
  - {{ .Values.cacheType | quote }}
71
89
  - --flash-attn
72
90
  - {{ .Values.flashAttention | quote }}
73
- - -t
74
- - {{ .Values.threads | quote }}
75
91
  ports:
76
92
  - containerPort: 8080
77
93
  name: http
@@ -1,8 +1,12 @@
1
1
  # The one definition of the local model: the helm-direct path installs this
2
2
  # chart (.devcontainer/llm/llm.sh) as the release llm. No Secret: the model is
3
3
  # public and checked by its sha256.
4
- # Official llama.cpp server image, CPU, pinned build
5
- image: ghcr.io/ggml-org/llama.cpp:server-b12407
4
+ # Official llama.cpp image repository (CPU). The tag is derived from llamaBuild:
5
+ # server-<llamaBuild> runs the model, full-<llamaBuild> (llama-bench, only for
6
+ # the bench Job) comes from the same build.
7
+ image: ghcr.io/ggml-org/llama.cpp
8
+ # The one pinned llama.cpp build, shared by the server and the bench images
9
+ llamaBuild: b12407
6
10
  # Image of the init container that downloads and checks the model
7
11
  fetchImage: curlimages/curl:8.11.1
8
12
  # Port of the Service and of llama-server
@@ -13,8 +17,8 @@ memory: 6Gi
13
17
  claim: llm-models
14
18
  # Size of the models volume
15
19
  size: 8Gi
16
- # Context size (-c) and threads (-t) of llama-server. 32768 is the native
17
- # window of Qwen2.5; the light preset uses 16384 (--set contextSize=16384).
20
+ # Context size (-c) of llama-server. 32768 is the native window of Qwen2.5; the
21
+ # light preset uses 16384 (--set contextSize=16384).
18
22
  contextSize: 32768
19
23
  # KV cache type for K and V (--cache-type-k / --cache-type-v): q8_0 costs about
20
24
  # 1 GB at 32k for the 7B (f16 about 1.9 GB). A quantized V cache needs flash
@@ -22,7 +26,10 @@ contextSize: 32768
22
26
  cacheType: q8_0
23
27
  # Flash attention (--flash-attn on|off|auto in server-b12407)
24
28
  flashAttention: "on"
25
- threads: 4
29
+ # Threads (-t and --threads-batch): auto = the CPUs seen by the container
30
+ # (nproc), capped by maxThreads; a number is used as is.
31
+ threads: auto
32
+ maxThreads: 8
26
33
  # The model: downloaded only when the file is missing, then its sha256 is
27
34
  # checked (the file is removed and the pod fails when it differs). The URL is
28
35
  # pinned to a Hugging Face commit (resolve/<commit>).
@@ -39,8 +46,27 @@ model:
39
46
  url: https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct-GGUF/resolve/13fb94bfda8c8cf22497dc57b78f391a9acb426a/qwen2.5-coder-7b-instruct-q4_k_m.gguf
40
47
  file: qwen2.5-coder-7b-instruct-q4_k_m.gguf
41
48
  sha256: 509287f78cb4d4cf6b3843734733b914b2c158e43e22a7f4bf5e963800894d3c
49
+ # CPU: a request only (no CPU limit, so the threads are not throttled)
42
50
  resources:
43
51
  requests:
44
- cpu: 500m
52
+ cpu: "2"
45
53
  limits:
46
54
  memory: 7Gi
55
+ # llama-bench Job (templates/bench-job.yaml), rendered only when enabled=true,
56
+ # which `devzone llm bench` sets. It runs the image full-<llamaBuild> (larger
57
+ # than the server image, pulled only for the bench) on the node of the server
58
+ # pod, with the models volume read-only, and is removed after ttl seconds.
59
+ bench:
60
+ enabled: false
61
+ # Prompt tokens (-p), generated tokens (-n), repetitions of each test (-r;
62
+ # llama-bench defaults to 5) and the thread counts tried (-t). Small values:
63
+ # the whole bench takes a few minutes, even on a slow machine.
64
+ prompt: 128
65
+ gen: 32
66
+ repetitions: 1
67
+ threads: "4,8"
68
+ # Seconds before the finished Job is garbage collected
69
+ ttl: 600
70
+ # Seconds before a stuck Job is stopped (activeDeadlineSeconds: the Job does
71
+ # not run forever if the call that started it is interrupted)
72
+ deadline: 1800
@@ -4,6 +4,7 @@
4
4
  # Sourced by manage/workspace.sh (drapeau_kubectl, POD, NAMESPACE).
5
5
  # devzone workspace services enable <service> [options]
6
6
  # devzone workspace services disable <service> [--yes]
7
+ # devzone workspace services bench llm [--apply] [--threads …] [--prompt …] [--gen …]
7
8
  # devzone workspace services status
8
9
  # Why: the pod has no administrator access to the cluster (#430), while the
9
10
  # installers need one. The workstation creates a ServiceAccount bound to
@@ -19,7 +20,7 @@ SERVICES_ADMIN_SCRIPT="${DEVZONE_SERVICES_ADMIN_SCRIPT:-/usr/local/share/devzone
19
20
  SERVICES_TOKEN_DURATION="${DEVZONE_SERVICES_TOKEN_DURATION:-1h}"
20
21
 
21
22
  services_usage() {
22
- echo "devzone workspace services enable|disable <gitlab|postgres|mysql|argocd|llm> [options] | seed gitlab | status"
23
+ echo "devzone workspace services enable|disable <gitlab|postgres|mysql|argocd|llm> [options] | seed gitlab | bench llm [--apply] [--threads …] [--prompt …] [--gen …] | status"
23
24
  }
24
25
 
25
26
  services_known() {
@@ -29,6 +30,16 @@ services_known() {
29
30
  return 1
30
31
  }
31
32
 
33
+ # A successful enable/disable is kept in .devzone.modules of the workstation so
34
+ # that a new devcontainer does not reinstall what was removed (#605). state_note
35
+ # (argocd-workspace.sh) updates the line and keeps the other ones intact.
36
+ services_state_note() {
37
+ case "$1" in
38
+ enable) state_note "$2" on ;;
39
+ disable) state_note "$2" off ;;
40
+ esac
41
+ }
42
+
32
43
  # Namespace of a service in the cluster (gitlab: default instance)
33
44
  services_namespace() {
34
45
  case "$1" in
@@ -97,13 +108,20 @@ services_run() {
97
108
  # charts: done by the workstation, no installer in the pod (#516, #538)
98
109
  if [ "$service" = argocd ]; then
99
110
  argocd_toggle "$action" "$@"
100
- return
111
+ code=$?
112
+ [ "$code" -eq 0 ] || return "$code"
113
+ services_state_note "$action" "$service"
114
+ return 0
101
115
  fi
116
+ # bench is a measure, not a change of state: never taken by Argo CD
102
117
  case "$service" in
103
118
  postgres | mysql | llm)
104
- if argocd_holds_charts; then
119
+ if [ "$action" != bench ] && argocd_holds_charts; then
105
120
  services_argocd_toggle "$service" "$action" "$@"
106
- return
121
+ code=$?
122
+ [ "$code" -eq 0 ] || return "$code"
123
+ services_state_note "$action" "$service"
124
+ return 0
107
125
  fi
108
126
  ;;
109
127
  esac
@@ -136,6 +154,7 @@ services_run() {
136
154
  echo "✖ $action $service failed (code $code); in the pod: devzone status" >&2
137
155
  return "$code"
138
156
  fi
157
+ services_state_note "$action" "$service"
139
158
  echo "✔ $action $service done; in the pod: devzone status; local access: devzone workspace ports"
140
159
  }
141
160
 
@@ -167,6 +186,14 @@ services() {
167
186
  fi
168
187
  services_run seed gitlab
169
188
  ;;
189
+ # The speed of the model measured from the workstation, in the pod (#593)
190
+ bench)
191
+ if [ "${2:-}" != llm ]; then
192
+ echo "✖ bench: only llm ($(services_usage))" >&2
193
+ return 1
194
+ fi
195
+ services_run bench llm "${@:3}"
196
+ ;;
170
197
  status | etat | '') services_status ;;
171
198
  *)
172
199
  echo "✖ unknown subcommand: $sub ($(services_usage))" >&2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "devzone",
3
- "version": "0.44.0",
3
+ "version": "0.45.1",
4
4
  "description": "Ton poste de développement Linux, prêt en une commande, identique sur Mac, Windows et Linux.",
5
5
  "license": "GPL-3.0-only",
6
6
  "repository": {