Skip to content

Commit c1964fa

Browse files
committed
feat: add freeform runnable, pre_run with umask 0002 default, add slice-positions param
1 parent c833c6e commit c1964fa

2 files changed

Lines changed: 57 additions & 12 deletions

File tree

runnables.yaml renamed to .fileglancer/runnables.yaml

Lines changed: 44 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,18 @@ name: Paintera Conversion Helper
22
description: >-
33
Convert N5/Zarr/HDF5 datasets to or from Paintera-style N5 datasets
44
Submits a Spark job to the Janelia cluster via flintstone;
5-
repo_url: https://github.com/saalfeldlab/paintera-conversion-helper
65
76
runnables:
87
- id: to-paintera
98
name: Convert Scalar Dataset To Paintera
109
description: >-
11-
Convert raw or label datasets into a Paintera-compatible N5 group with a multiscale
12-
mipmap pyramid, running on N_NODES cluster worker nodes via flintstone.
10+
Convert raw or label data into a Paintera-compatible N5 dataset with a multiscale pyramid.
1311
working_dir: repo
1412
resources:
1513
cpus: 1
1614
memory: "4 GB"
1715
walltime: "24:00"
18-
pre_run: git submodule update --init --recursive
16+
pre_run: umask 0002 && git submodule update --init --recursive
1917
command: >-
2018
./startup-scripts/fileglancer-paintera-convert.sh to-paintera
2119
parameters:
@@ -35,6 +33,7 @@ runnables:
3533
- flag: --type
3634
name: Type
3735
type: enum
36+
description: "The Paintera dataset type of the converted dataset"
3837
options:
3938
- raw
4039
- label
@@ -57,6 +56,13 @@ runnables:
5756
type: string
5857
required: false
5958
description: "Physical resolution x,y,z; overrides the input's resolution attribute. Example: 4,4,40"
59+
- flag: --slice-positions
60+
name: Slice positions
61+
type: string
62+
required: false
63+
description: >-
64+
Reduce an nD input to a 3D XYZ Paintera source. One entry per input axis in source dimension
65+
order: x/y/z mark the spatial axes, an integer slices that axis at the given index. Example: z,y,x,0,10
6066
- flag: --scale
6167
name: Scale factors
6268
type: string
@@ -73,7 +79,7 @@ runnables:
7379
name: Reverse array attributes
7480
type: boolean
7581
default: false
76-
description: "Reverse resolution/offset arrays, i.e. [x,y,z] -> [z,y,x]"
82+
description: "Reverse resolution/offset arrays, i.e. [x,y,z] -> [z,y,x]. NOTE: N5-Zarr interop generally handles this automatically, especially for Zarr3. Only Reverse if you are sure it's necessary."
7783
- flag: --winner-takes-all-downsampling
7884
name: Winner-takes-all downsampling
7985
hidden: true
@@ -97,7 +103,7 @@ runnables:
97103
cpus: 1
98104
memory: "4 GB"
99105
walltime: "24:00"
100-
pre_run: git submodule update --init --recursive
106+
pre_run: umask 0002 && git submodule update --init --recursive
101107
command: >-
102108
./startup-scripts/fileglancer-paintera-convert.sh to-scalar
103109
parameters:
@@ -175,3 +181,35 @@ runnables:
175181
type: boolean
176182
default: false
177183
description: "Apply the Paintera fragment-segment-assignment; ignored for non-Paintera inputs"
184+
185+
- id: freeform
186+
name: Freeform Arguments
187+
description: >-
188+
Run to-paintera or to-scalar with hand-written arguments, for anything the guided forms
189+
don't cover. Reports the Spark web UI URL and waits for the job to finish.
190+
working_dir: repo
191+
resources:
192+
cpus: 1
193+
memory: "4 GB"
194+
walltime: "24:00"
195+
pre_run: umask 0002 && git submodule update --init --recursive
196+
command: >-
197+
./startup-scripts/fileglancer-paintera-convert.sh
198+
parameters:
199+
- flag: --n-nodes
200+
name: Worker nodes
201+
type: integer
202+
required: true
203+
min: 1
204+
description: "Number of cluster worker nodes for the Spark job"
205+
- name: Freeform (paste arguments)
206+
type: string
207+
raw: true
208+
required: true
209+
description: >-
210+
Paste a paintera-convert invocation starting with the subcommand (to-paintera or to-scalar),
211+
followed by its arguments.
212+
Flags may use `--flag value` or `--flag=value`.
213+
repeated values are whitespace-separated (e.g. --scale 2,2,2 2,2,2).
214+
Shell operators (`;` `|` `&` `$` backticks) are not allowed.
215+
Example: to-paintera --container=in.zarr -d labels/s0 --output-container=out.n5 --target-dataset=labels --type=label --scale 2,2,2 2,2,2 --block-size=32,32,32

startup-scripts/fileglancer-paintera-convert.sh

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
# -> shutdown LSF chain and returns. We locate the run from flintstone's own output, then
1515
# poll the shared-filesystem logs and the driver job's LSF state.
1616
#
17-
# usage: fileglancer-paintera-convert.sh <subcommand> --n-nodes N [paintera-convert args...]
17+
# usage: fileglancer-paintera-convert.sh [--n-nodes N] <subcommand> [paintera-convert args...]
18+
#
19+
# `--n-nodes` may appear anywhere (Fileglancer emits flagged fields before positional ones); it is
20+
# pulled out and the first remaining token is taken as the subcommand.
1821

1922
set -uo pipefail
2023

2124
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
2225

23-
SUBCOMMAND="${1:?missing subcommand (to-paintera|to-scalar)}"
24-
shift
25-
2626
# how often to poll, and how long to wait for the web UI URL before giving up on it (the
2727
# conversion keeps being waited on regardless)
2828
POLL_INTERVAL="${FG_POLL_INTERVAL:-30}"
@@ -31,19 +31,26 @@ URL_TIMEOUT="${FG_URL_TIMEOUT:-1800}"
3131
MAX_UNSEEN_POLLS="${FG_MAX_UNSEEN_POLLS:-20}"
3232

3333
N_NODES=""
34-
PAINTERA_ARGS=()
34+
REST=()
3535
while [[ $# -gt 0 ]]; do
3636
case "$1" in
3737
--n-nodes) N_NODES="$2"; shift 2 ;;
3838
--n-nodes=*) N_NODES="${1#*=}"; shift ;;
39-
*) PAINTERA_ARGS+=("$1"); shift ;;
39+
*) REST+=("$1"); shift ;;
4040
esac
4141
done
4242

4343
if [[ -z "$N_NODES" ]]; then
4444
echo "error: --n-nodes is required" 1>&2
4545
exit 1
4646
fi
47+
if [[ "${#REST[@]}" -eq 0 ]]; then
48+
echo "error: missing subcommand (to-paintera|to-scalar)" 1>&2
49+
exit 1
50+
fi
51+
52+
SUBCOMMAND="${REST[0]}"
53+
PAINTERA_ARGS=("${REST[@]:1}")
4754

4855
USER_NAME="${USER:-$(id -un)}"
4956

0 commit comments

Comments
 (0)