-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaskfile.yml
More file actions
246 lines (224 loc) · 9.46 KB
/
Copy pathTaskfile.yml
File metadata and controls
246 lines (224 loc) · 9.46 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
version: "3"
dotenv: [".env"]
includes:
install:
dir: .
taskfile: Taskfile.install.yml
droid:
dir: deployments/fr3_droid
taskfile: deployments/fr3_droid/Taskfile.yml
vars:
PRETTIER_VERSION: 3.6.2
RUFF_VERSION: 0.12.1
RUFF_THIRD_PARTY_EXCLUDE: "**/third_party/**"
SHFMT_EXCLUDE_REGEX: "(^|/)tmp/|(^|/)third_party/|(^|/)\\.venv/"
# Docker vars
BUILD_CREATED:
sh: date -u +'%Y-%m-%dT%H:%M:%SZ'
GIT_COMMIT:
sh: git rev-parse HEAD 2>/dev/null || echo "latest"
BUILD_VERSION: '{{.BUILD_VERSION | default .GIT_COMMIT}}'
BUILD_TARGET: '{{.BUILD_TARGET | default "dev"}}'
DOCKER_REGISTRY: '{{.DOCKER_REGISTRY | default "registry.localhost"}}'
DOCKER_TAG: '{{.DOCKER_TAG | default "latest"}}'
tasks:
list-services:
desc: List all available services
cmds:
- |
echo "Available services:"
find services -name "docker-compose.yml" -type f | grep -v "third_party" | xargs -I{} dirname {} | xargs -I{} basename {} | sort
lerobot-export:
desc: "Convert raw episodes -> ONE LeRobot dataset, synchronised (usage: task lerobot-export DATASET=name [INPUT=..] [DEPLOYMENT=..] [FPS=20] [LIMIT=0])"
preconditions:
- sh: '[ -n "{{.DATASET}}" ]'
msg: "DATASET is required. Usage: task lerobot-export DATASET=name"
cmds:
- bash scripts/lerobot_export.sh DATASET={{.DATASET}} INPUT={{.INPUT}} OUTPUT={{.OUTPUT}} DEPLOYMENT={{.DEPLOYMENT}} FPS={{.FPS}} LIMIT={{.LIMIT}}
build:
desc: "Build service container (usage: task build SERVICE=name)"
preconditions:
- sh: '[ -n "{{.SERVICE}}" ]'
msg: "SERVICE is required. Usage: task build SERVICE=name"
cmds:
- |
SERVICE_PATH=$(find services -type d -name "{{.SERVICE}}" 2>/dev/null | head -1)
if [ -z "$SERVICE_PATH" ]; then
echo "Error: Service not found: {{.SERVICE}}" >&2
exit 1
fi
cd "$SERVICE_PATH"
docker compose build $([ "${NO_CACHE}" = "1" ] && echo "--no-cache") \
--build-arg BUILD_TARGET={{.BUILD_TARGET}} \
--build-arg BUILD_VERSION={{.BUILD_VERSION}} \
--build-arg GIT_COMMIT={{.GIT_COMMIT}}
start:
desc: "Start service container (usage: task start SERVICE=name)"
deps: [build]
preconditions:
- sh: '[ -n "{{.SERVICE}}" ]'
msg: "SERVICE is required. Usage: task start SERVICE=name"
cmds:
- |
SERVICE_PATH=$(find services -type d -name "{{.SERVICE}}" 2>/dev/null | head -1)
if [ -z "$SERVICE_PATH" ]; then
echo "Error: Service not found: {{.SERVICE}}" >&2
exit 1
fi
cd "$SERVICE_PATH"
docker compose up -d
start-droid:
desc: "Start unified fr3_droid recording and teleop stack (no franka-policy; ~1 core lighter per node)"
aliases: [droid]
cmds:
- task: droid:start-prod
start-droid-inference:
desc: "Start unified fr3_droid stack with franka-policy enabled (requires GPU_INFER_ENDPOINT in .env)"
aliases: [droid-inference]
cmds:
- task: droid:start-prod-inference
stop:
desc: "Stop a service (SERVICE=name) or the unified fr3_droid project"
cmds:
- |
if [ -n "{{.SERVICE}}" ]; then
SERVICE_PATH=$(find services -type d -name "{{.SERVICE}}" 2>/dev/null | head -1)
if [ -z "$SERVICE_PATH" ]; then echo "Error: Service not found: {{.SERVICE}}" >&2; exit 1; fi
cd "$SERVICE_PATH" && docker compose down
else
docker compose -p fr3_droid down --remove-orphans
fi
restart:
desc: "Restart service container (usage: task restart SERVICE=name)"
cmds:
- task: stop
- task: start
logs:
desc: "Show service logs (usage: task logs SERVICE=name)"
preconditions:
- sh: '[ -n "{{.SERVICE}}" ]'
msg: "SERVICE is required. Usage: task logs SERVICE=name"
cmds:
- |
if ! docker ps --format '{{`{{.Names}}`}}' | grep -qx "{{.SERVICE}}"; then
echo "Error: Container '{{.SERVICE}}' is not running" >&2
docker ps --format ' {{`{{.Names}}`}}' | sort
exit 1
fi
docker logs -f {{.SERVICE}}
exec:
desc: "Exec into service container (usage: task exec SERVICE=name)"
preconditions:
- sh: '[ -n "{{.SERVICE}}" ]'
msg: "SERVICE is required. Usage: task exec SERVICE=name"
cmds:
- |
if ! docker ps --format '{{`{{.Names}}`}}' | grep -qx "{{.SERVICE}}"; then
echo "Error: Container '{{.SERVICE}}' is not running" >&2
echo "Running containers:"
docker ps --format ' {{`{{.Names}}`}}' | sort
exit 1
fi
docker exec -it {{.SERVICE}} bash
format-check:
desc: Check file formatting
cmds:
- |
if [[ "$CI" == 1 ]];then
uvx ruff@{{.RUFF_VERSION}} format --check --exclude "{{.RUFF_THIRD_PARTY_EXCLUDE}}" .
npx prettier@{{.PRETTIER_VERSION}} --check "**/*.json"
npx prettier@{{.PRETTIER_VERSION}} --check "**/*.md"
shfmt -f . | grep -vE "{{.SHFMT_EXCLUDE_REGEX}}" | xargs shfmt -i 4 -ci -d
else
uvx ruff@{{.RUFF_VERSION}} format --check --exclude "{{.RUFF_THIRD_PARTY_EXCLUDE}}" .
docker pull tmknom/prettier:{{.PRETTIER_VERSION}}
docker run --rm -u "$(id -u):$(id -g)" -v $(pwd):/work tmknom/prettier:{{.PRETTIER_VERSION}} --check "**/*.json"
docker run --rm -u "$(id -u):$(id -g)" -v $(pwd):/work tmknom/prettier:{{.PRETTIER_VERSION}} --check "**/*.md"
shfmt -f . | grep -vE "{{.SHFMT_EXCLUDE_REGEX}}" | xargs shfmt -i 4 -ci -d
fi
format:
desc: Format files
cmds:
- |
if [[ "$CI" == 1 ]];then
uvx ruff@{{.RUFF_VERSION}} format --exclude "{{.RUFF_THIRD_PARTY_EXCLUDE}}" .
npx prettier@{{.PRETTIER_VERSION}} --write "**/*.json"
npx prettier@{{.PRETTIER_VERSION}} --write "**/*.md"
shfmt -f . | grep -vE "{{.SHFMT_EXCLUDE_REGEX}}" | xargs shfmt -i 4 -ci -w
else
uvx ruff@{{.RUFF_VERSION}} format --exclude "{{.RUFF_THIRD_PARTY_EXCLUDE}}" .
docker run --rm -u "$(id -u):$(id -g)" -v $(pwd):/work tmknom/prettier:{{.PRETTIER_VERSION}} --write "**/*.json"
docker run --rm -u "$(id -u):$(id -g)" -v $(pwd):/work tmknom/prettier:{{.PRETTIER_VERSION}} --write "**/*.md"
shfmt -f . | grep -vE "{{.SHFMT_EXCLUDE_REGEX}}" | xargs shfmt -i 4 -ci -w
fi
lint-check:
desc: Check file linting
cmds:
- uvx ruff@{{.RUFF_VERSION}} check --exclude "{{.RUFF_THIRD_PARTY_EXCLUDE}}" .
lint:
desc: Fix lint issues (Ruff auto-fix)
cmds:
- |
if [[ "$CI" == 1 ]];then
uvx ruff@{{.RUFF_VERSION}} check --exclude "{{.RUFF_THIRD_PARTY_EXCLUDE}}" .
else
uvx ruff@{{.RUFF_VERSION}} check --exclude "{{.RUFF_THIRD_PARTY_EXCLUDE}}" --fix .
fi
pre-commit-check:
desc: Pre commit check
cmds:
- task: format-check
- task: lint-check
# ---------------------------------------------------------------------------
# Dataset Builder
# ---------------------------------------------------------------------------
#
# Quick usage — convert a single episode:
#
# task dataset-builder-convert-episode \
# INPUT_MCAP=/workspace/data/processed_episodes/<date>/<uuid>/mcap/mcap_0.mcap \
# DATASET_NAME=<dataset-name>
#
# The output is written to /workspace/data/datasets/lerobot/<dataset-name>.
# Override with OUTPUT_DIR if a non-standard path is needed.
# DEPLOYMENT_DIR defaults to /workspace/deployments/example_station.
# Pass extra CLI flags via CLI_ARGS, e.g. CLI_ARGS="--fps 30".
# Override data paths via DATA_ROOT (default ./data) and DEPLOYMENTS_ROOT (default ./deployments).
# ---------------------------------------------------------------------------
dataset-builder-run:
desc: "Run a command inside the dataset-builder container (usage: task dataset-builder-run CMD='uv run pytest')"
vars:
CMD: '{{.CMD | default "/bin/bash"}}'
cmds:
- task: build
vars: { SERVICE: dataset-builder }
- |
docker run -it --rm \
-v ${DATA_ROOT:-./data}:/workspace/data \
-v ${DEPLOYMENTS_ROOT:-./deployments}:/workspace/deployments \
{{.DOCKER_REGISTRY}}/labs/dataset-builder:{{.DOCKER_TAG}} \
{{.CMD}}
dataset-builder-convert-episode:
desc: Convert a single processed MCAP episode to a LeRobot dataset (set INPUT_MCAP, DATASET_NAME; optionally DEPLOYMENT_DIR)
vars:
INPUT_MCAP: '{{.INPUT_MCAP | default .Env.INPUT_MCAP}}'
DATASET_NAME: '{{.DATASET_NAME | default (.Env.DATASET_NAME | default "my-dataset")}}'
DEPLOYMENT_DIR: '{{.DEPLOYMENT_DIR | default (.Env.DEPLOYMENT_DIR | default "/workspace/deployments/fr3_droid")}}'
preconditions:
- sh: '[ -n "{{.INPUT_MCAP}}" ]'
msg: "INPUT_MCAP is required. Usage: task dataset-builder-convert-episode INPUT_MCAP=... DATASET_NAME=..."
- sh: '[ -n "{{.DATASET_NAME}}" ]'
msg: "DATASET_NAME is required. Usage: task dataset-builder-convert-episode INPUT_MCAP=... DATASET_NAME=..."
cmds:
- task: build
vars: { SERVICE: dataset-builder }
- |
docker run --rm \
-v ${DATA_ROOT:-./data}:/workspace/data \
-v ${DEPLOYMENTS_ROOT:-./deployments}:/workspace/deployments \
{{.DOCKER_REGISTRY}}/labs/dataset-builder:{{.DOCKER_TAG}} \
./entrypoint.sh \
--dataset-name {{.DATASET_NAME}} \
--deployment-dir {{.DEPLOYMENT_DIR}} \
single --input {{.INPUT_MCAP}} \
{{.CLI_ARGS}}