Skip to content

Commit e7bc1b8

Browse files
authored
Merge branch 'main' into fix/simplify-publish-dialog-version-names
2 parents 689dbb0 + b14cb35 commit e7bc1b8

7 files changed

Lines changed: 449 additions & 134 deletions

File tree

.github/workflows/pytest-cli-live-server.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,4 @@ jobs:
104104
TLAB_LIVE_SERVER_URL: "http://127.0.0.1:8338"
105105
run: |
106106
cd ../cli
107-
uv run pytest tests/integration/test_live_compute_provider_routes.py -v
107+
uv run pytest tests/integration/test_live_cli_routes.py -v

api/transformerlab/routers/experiment/task.py

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -203,23 +203,31 @@ async def task_list_files(task_id: str) -> TaskFilesResponse:
203203
local_files.append(str(src))
204204
elif tgt:
205205
local_files.append(str(tgt))
206-
elif isinstance(file_mounts, bool) and file_mounts:
207-
# For upload-from-directory tasks, files are materialized in the
208-
# per-task workspace directory: workspace/task/{task_id}. List all
209-
# entries in that directory so the UI can show what will be mounted.
210-
try:
211-
workspace_dir = await get_workspace_dir()
212-
if workspace_dir:
213-
task_dir = storage.join(workspace_dir, "task", str(task_id))
214-
if await storage.exists(task_dir):
215-
entries = await storage.ls(task_dir)
216-
for entry in entries:
217-
# storage.ls returns full paths; strip the task_dir prefix
218-
name = entry.replace(task_dir, "").lstrip("/").lstrip("\\")
219-
if name:
220-
local_files.append(name)
221-
except Exception as e: # pragma: no cover - defensive logging
222-
print(f"Error listing local files for task {task_id} from task dir: {e}")
206+
207+
# Always list files from the per-task workspace directory (workspace/task/{task_id}).
208+
# This directory contains at minimum the task.yaml, and for upload-from-directory
209+
# tasks it also contains user-uploaded files.
210+
try:
211+
workspace_dir = await get_workspace_dir()
212+
if workspace_dir:
213+
task_dir = storage.join(workspace_dir, "task", str(task_id))
214+
if await storage.exists(task_dir):
215+
entries = await storage.ls(task_dir)
216+
# Build a set of basenames already in local_files for dedup.
217+
existing_basenames = {os.path.basename(f.split(" -> ")[-1].strip()) for f in local_files}
218+
for entry in entries:
219+
# storage.ls returns full paths; compute relative path safely
220+
try:
221+
name = os.path.relpath(entry, task_dir)
222+
except ValueError:
223+
continue # entry is not under task_dir; skip it
224+
if not name or name == "." or name == "index.json":
225+
continue
226+
if name not in existing_basenames:
227+
local_files.append(name)
228+
existing_basenames.add(name)
229+
except Exception as e: # pragma: no cover - defensive logging
230+
print(f"Error listing local files for task {task_id} from task dir: {e}")
223231

224232
# Return None instead of empty list when there is no data for a source.
225233
return TaskFilesResponse(

cli/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "transformerlab-cli"
7-
version = "0.0.10"
7+
version = "0.0.11"
88
description = "Transformer Lab CLI"
99
requires-python = ">=3.10"
1010
authors = [{ name = "Transformer Lab", email = "hello@transformerlab.ai" }]

0 commit comments

Comments
 (0)