labnotes 0.0.83__tar.gz → 0.0.85__tar.gz
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.
- {labnotes-0.0.83 → labnotes-0.0.85}/PKG-INFO +6 -2
- {labnotes-0.0.83 → labnotes-0.0.85}/README.md +5 -1
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/context.md +11 -7
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/experiments.py +16 -4
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/models.py +1 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/run_control.py +2 -1
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/runner/describe_event.py +4 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/runner/run_experiment.py +12 -1
- labnotes-0.0.85/src/labnotes/tui/browse_app.py +25 -0
- labnotes-0.0.85/src/labnotes/tui/browse_tui.py +8 -0
- labnotes-0.0.85/src/labnotes/tui/experiment_screen.py +80 -0
- labnotes-0.0.85/src/labnotes/tui/experiments_screen.py +47 -0
- labnotes-0.0.85/src/labnotes/tui/group_cells.py +26 -0
- labnotes-0.0.85/src/labnotes/tui/invocation_columns.py +9 -0
- labnotes-0.0.85/src/labnotes/tui/invocation_rows.py +31 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/tui/run_app.py +79 -4
- labnotes-0.0.85/src/labnotes/tui/run_cells.py +29 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/testing-conventions.toml +24 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/.gitignore +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/CHANGELOG.md +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/MIGRATIONS.md +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/pyproject.toml +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/__init__.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/__main__.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/asset_url.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/check_counts.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/cli.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/context_guide.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/count_groups.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/count_runs.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/create_app.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/create_experiment.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/create_note.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/daemon/__init__.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/daemon/control_run.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/daemon/daemon_app.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/daemon/daemon_client.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/daemon/daemon_running.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/daemon/daemon_server.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/daemon/describe_status.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/daemon/ensure_daemon.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/daemon/exit_when_idle.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/daemon/remote_start.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/daemon/run_daemon.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/daemon/run_logs.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/daemon/serve_daemon.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/daemon/socket_path.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/daemon/stop_runs.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/daemon/watch_daemon.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/daemon/watch_status.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/daemon_command.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/data_html.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/default_config_text.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/default_counts.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/drain_watch.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/experiment_notes.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/experiment_runs.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/file_changes.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/format_duration.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/format_started.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/format_value.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/group_runs.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/init.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/invocation_started.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/is_positive_int.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/list_experiments.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/list_runs.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/load_config.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/load_experiment.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/load_run.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/modes.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/nests_runs.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/note_path.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/notebook_kernel.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/output_html.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/parse_run_view.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/print_rows.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/python_blocks.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/read_config.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/read_path.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/render_markdown.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/run_command.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/run_output.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/run_status.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/runner/__init__.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/runner/execute_run.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/runner/hold_folder.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/runner/new_param_run_id.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/runner/new_run_id.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/runner/new_stamped_run_id.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/runner/param_args.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/runner/param_grid.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/runner/param_run_name.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/runner/plan_runs.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/runner/prepare_experiment.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/runner/read_experiment_config.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/runner/run_folder.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/runner/run_headless.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/runner/runs_parent.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/runner/shell_command.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/runner/signal_tree.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/runner/stop_then_kill.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/runner/wait_for_tree.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/runner/write_run_json.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/save_conflict_copy.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/save_note.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/saved_outputs.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/serve_app.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/server.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/shared_params.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/sort_href.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/sql_quote.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/static/elapsed.js +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/static/experiment.js +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/static/labnotes.css +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/static/local-time.js +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/static/new-note.js +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/static/note-edit.js +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/static/note-editor.js +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/static/row-link.js +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/static/run-cell.js +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/static/run-output.js +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/static/view-toggle.js +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/summarize_config.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/tables/__init__.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/tables/experiment_rows.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/tables/experiment_run_ids.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/tables/file_prefix.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/tables/file_text.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/tables/iso_time.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/tables/list_experiment_runs.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/tables/note_text.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/tables/open_tables.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/tables/path_glob.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/tables/path_pattern.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/tables/read_experiment.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/tables/read_file.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/tables/read_log.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/tables/read_run.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/tables/summarize_experiments.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/templates/base.html +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/templates/editor_imports.html +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/templates/experiment.html +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/templates/index.html +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/templates/note.html +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/templates/run.html +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/tui/__init__.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/tui/dim.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/tui/format_elapsed.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/tui/run_tui.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/tui/runs_table.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/src/labnotes/wait_for_note.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/tests/integration/conftest.py +0 -0
- {labnotes-0.0.83 → labnotes-0.0.85}/uv.lock +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: labnotes
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.85
|
|
4
4
|
Summary: Browse experiment designs, notes, and run data from a folder.
|
|
5
5
|
Project-URL: Repository, https://github.com/thekevinscott/labnotes
|
|
6
6
|
Author-email: Kevin Scott <me@thekevinscott.com>
|
|
@@ -68,7 +68,11 @@ labnotes experiments foo # the same, plus config
|
|
|
68
68
|
labnotes experiments foo runs # foo's runs, oldest first
|
|
69
69
|
```
|
|
70
70
|
|
|
71
|
-
Each takes `--format table`
|
|
71
|
+
Each takes `--format table` or `--format json`, which print rows and exit.
|
|
72
|
+
Without `--format`, `labnotes experiments` and `labnotes experiments foo` open
|
|
73
|
+
a browser in a terminal: the experiment list, Enter to open one, Escape to go
|
|
74
|
+
back. An experiment shows its runs grouped by invocation; Space opens one.
|
|
75
|
+
Piped, they print a table.
|
|
72
76
|
|
|
73
77
|
`labnotes experiments new [NAME]` creates an experiment folder with a starter
|
|
74
78
|
`experiment.toml`, picking a random name if you give none. `new` itself can't
|
|
@@ -44,7 +44,11 @@ labnotes experiments foo # the same, plus config
|
|
|
44
44
|
labnotes experiments foo runs # foo's runs, oldest first
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
Each takes `--format table`
|
|
47
|
+
Each takes `--format table` or `--format json`, which print rows and exit.
|
|
48
|
+
Without `--format`, `labnotes experiments` and `labnotes experiments foo` open
|
|
49
|
+
a browser in a terminal: the experiment list, Enter to open one, Escape to go
|
|
50
|
+
back. An experiment shows its runs grouped by invocation; Space opens one.
|
|
51
|
+
Piped, they print a table.
|
|
48
52
|
|
|
49
53
|
`labnotes experiments new [NAME]` creates an experiment folder with a starter
|
|
50
54
|
`experiment.toml`, picking a random name if you give none. `new` itself can't
|
|
@@ -29,12 +29,14 @@ Keys come from folder names, so renaming a folder renames its rows on the next
|
|
|
29
29
|
read. Paths are relative to the root, and times are UTC ISO 8601.
|
|
30
30
|
|
|
31
31
|
```sh
|
|
32
|
-
labnotes experiments # name, last_run, created, files, runs
|
|
33
|
-
labnotes experiments foo # the same, plus config
|
|
34
|
-
labnotes experiments foo runs # foo's runs, oldest first
|
|
32
|
+
labnotes experiments --format json # name, last_run, created, files, runs
|
|
33
|
+
labnotes experiments foo --format json # the same, plus config
|
|
34
|
+
labnotes experiments foo runs --format json # foo's runs, oldest first
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
Always pass `--format json` (to parse) or `--format table`. Without `--format`,
|
|
38
|
+
`labnotes experiments` and `labnotes experiments foo` open an interactive
|
|
39
|
+
browser when they find a terminal, and wait for keys that never come.
|
|
38
40
|
|
|
39
41
|
`labnotes experiments new [NAME]` creates an experiment folder with a starter
|
|
40
42
|
`experiment.toml`, picking a random name if you give none. `new` itself can't
|
|
@@ -91,14 +93,15 @@ A script run by labnotes should:
|
|
|
91
93
|
- stop any background process it starts before it exits; the run ends when `command` exits.
|
|
92
94
|
- flush its output as it goes (`print(..., flush=True)`, or `PYTHONUNBUFFERED=1`), so the live view shows it as it happens.
|
|
93
95
|
|
|
94
|
-
Runs can take a long time. Start `run` in the background, then check on it with `labnotes experiments foo runs`; a run with no `ended` is still going.
|
|
96
|
+
Runs can take a long time. Start `run` in the background, then check on it with `labnotes experiments foo runs --format json`; a run with no `ended` is still going.
|
|
95
97
|
|
|
96
98
|
In a terminal, `run` shows a live table of runs (status and time) and stays
|
|
97
99
|
open when they finish. Failed runs show their status in red; `f` hides or shows them, and `r` on one
|
|
98
100
|
runs it again under a new id. `j` and `k` move the cursor, `g` and `G` jump to the
|
|
99
101
|
first and last row. Runs not started yet show grayed as `pending`, and as
|
|
100
102
|
`skipped` once stopped. Move the cursor to a pending run and press `n` to run it
|
|
101
|
-
next.
|
|
103
|
+
next. `m` grabs a pending run; `j` and `k` move it through the queue, Enter or `m`
|
|
104
|
+
drops it, Escape puts it back. Space deselects a pending run so it won't run; Space again puts it back at
|
|
102
105
|
the end of the queue. `/` filters rows by params text; Enter keeps the filter,
|
|
103
106
|
Escape clears it. `D` deselects every pending run the filter shows. `x` stops the
|
|
104
107
|
running run under the cursor; `x` again kills it. `+` and
|
|
@@ -127,7 +130,8 @@ going. Elsewhere, it prints a line per event instead.
|
|
|
127
130
|
waits for a daemon when none is up. `--json` prints one JSON object per line.
|
|
128
131
|
Following doesn't keep the daemon up.
|
|
129
132
|
- `labnotes run control NAME ACTION [ARG]` sends one live-view control to a
|
|
130
|
-
running experiment: `kill`, `retry`, `run_next` or `toggle` a run,
|
|
133
|
+
running experiment: `kill`, `retry`, `run_next` or `toggle` a run, `move` a
|
|
134
|
+
run to a place in the queue counted from 0,
|
|
131
135
|
`set_concurrency` to a number, `interrupt` or `finish`.
|
|
132
136
|
- A second `run` of the same experiment fails while the first is going.
|
|
133
137
|
- It exits 0 even if runs fail; the summary line counts failures. If it can't
|
|
@@ -11,6 +11,7 @@ from labnotes.print_rows import print_rows
|
|
|
11
11
|
from labnotes.read_config import CONFIG_FILE
|
|
12
12
|
from labnotes.runner.run_headless import run_headless
|
|
13
13
|
from labnotes.tables.experiment_rows import experiment_rows
|
|
14
|
+
from labnotes.tui.browse_tui import browse_tui
|
|
14
15
|
from labnotes.tui.run_tui import run_tui
|
|
15
16
|
|
|
16
17
|
|
|
@@ -24,8 +25,8 @@ from labnotes.tui.run_tui import run_tui
|
|
|
24
25
|
"--format",
|
|
25
26
|
"output_format",
|
|
26
27
|
type=click.Choice(["table", "json"]),
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
help="Print rows and exit. Unset, a terminal browses them instead;"
|
|
29
|
+
" anything else gets table.",
|
|
29
30
|
)
|
|
30
31
|
@click.option(
|
|
31
32
|
"--concurrency",
|
|
@@ -44,7 +45,7 @@ def experiments(
|
|
|
44
45
|
ctx: click.Context,
|
|
45
46
|
name: str | None,
|
|
46
47
|
action: str | None,
|
|
47
|
-
output_format: str,
|
|
48
|
+
output_format: str | None,
|
|
48
49
|
concurrency: int | None,
|
|
49
50
|
experiment_config: Path | None,
|
|
50
51
|
) -> None:
|
|
@@ -75,10 +76,21 @@ def experiments(
|
|
|
75
76
|
return
|
|
76
77
|
if action not in (None, "runs"):
|
|
77
78
|
raise click.UsageError(f"Unknown action {action}. Use runs or run.")
|
|
79
|
+
if (
|
|
80
|
+
action is None
|
|
81
|
+
and output_format is None
|
|
82
|
+
and sys.stdout.isatty()
|
|
83
|
+
and sys.stderr.isatty()
|
|
84
|
+
):
|
|
85
|
+
try:
|
|
86
|
+
browse_tui(config, name)
|
|
87
|
+
except ValueError as error:
|
|
88
|
+
raise click.ClickException(str(error)) from error
|
|
89
|
+
return
|
|
78
90
|
try:
|
|
79
91
|
rows = asyncio.run(experiment_rows(config, name, action))
|
|
80
92
|
except ValueError as error:
|
|
81
93
|
raise click.ClickException(str(error)) from error
|
|
82
94
|
if rows is None:
|
|
83
95
|
raise click.ClickException(f"No experiment named {name}.")
|
|
84
|
-
print_rows(rows, output_format)
|
|
96
|
+
print_rows(rows, output_format or "table")
|
|
@@ -18,7 +18,8 @@ PARAMS = {
|
|
|
18
18
|
name="control",
|
|
19
19
|
help=(
|
|
20
20
|
"Send one control to an experiment's runs, as the live view's keys do. "
|
|
21
|
-
"kill, retry, run_next and toggle take a run;
|
|
21
|
+
"kill, retry, run_next and toggle take a run; move a run and its new place "
|
|
22
|
+
"in the queue, from 0; set_concurrency a number; "
|
|
22
23
|
"interrupt and finish nothing."
|
|
23
24
|
),
|
|
24
25
|
)
|
|
@@ -14,6 +14,10 @@ def describe_event(event: dict[str, object]) -> str:
|
|
|
14
14
|
return f"{event['run']} {outcome}"
|
|
15
15
|
case "queued":
|
|
16
16
|
return f"{event['run']} runs next."
|
|
17
|
+
case "moved":
|
|
18
|
+
pending: list[str] = event["pending"] # type: ignore[assignment]
|
|
19
|
+
place = pending.index(str(event["run"])) + 1
|
|
20
|
+
return f"{event['run']} moved to {place} of {len(pending)} in the queue."
|
|
17
21
|
case "deselected":
|
|
18
22
|
return f"{event['run']} deselected."
|
|
19
23
|
case "reselected":
|
|
@@ -125,6 +125,13 @@ async def run_experiment(
|
|
|
125
125
|
plan.insert(0, entry)
|
|
126
126
|
arrange("queued", run)
|
|
127
127
|
|
|
128
|
+
def move(run: str, place: int) -> None:
|
|
129
|
+
entry = find(plan, run)
|
|
130
|
+
if entry is not None:
|
|
131
|
+
plan.remove(entry)
|
|
132
|
+
plan.insert(max(0, place), entry)
|
|
133
|
+
arrange("moved", run)
|
|
134
|
+
|
|
128
135
|
def toggle(run: str) -> None:
|
|
129
136
|
if stopping.is_set():
|
|
130
137
|
return
|
|
@@ -202,7 +209,11 @@ async def run_experiment(
|
|
|
202
209
|
ended[run] = params
|
|
203
210
|
results.append(result)
|
|
204
211
|
|
|
205
|
-
listen(
|
|
212
|
+
listen(
|
|
213
|
+
Controls(
|
|
214
|
+
interrupt, run_next, set_concurrency, toggle, kill, retry, finish, move
|
|
215
|
+
)
|
|
216
|
+
)
|
|
206
217
|
fill()
|
|
207
218
|
await done.wait()
|
|
208
219
|
await asyncio.gather(*started)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
from textual.app import App
|
|
2
|
+
from textual.binding import Binding
|
|
3
|
+
|
|
4
|
+
from labnotes.models import LabnotesConfig
|
|
5
|
+
from labnotes.tables.open_tables import open_tables
|
|
6
|
+
from labnotes.tui.experiment_screen import ExperimentScreen
|
|
7
|
+
from labnotes.tui.experiments_screen import ExperimentsScreen
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class BrowseApp(App[BaseException | None]):
|
|
11
|
+
BINDINGS = [Binding("q", "quit", "Quit")]
|
|
12
|
+
|
|
13
|
+
def __init__(self, config: LabnotesConfig, name: str | None) -> None:
|
|
14
|
+
super().__init__()
|
|
15
|
+
self.config = config
|
|
16
|
+
self.experiment_name = name
|
|
17
|
+
self.title = config.root.name
|
|
18
|
+
|
|
19
|
+
def on_mount(self) -> None:
|
|
20
|
+
tables = open_tables(self.config)
|
|
21
|
+
self.push_screen(ExperimentsScreen(tables, self.config))
|
|
22
|
+
if self.experiment_name is not None:
|
|
23
|
+
self.push_screen(
|
|
24
|
+
ExperimentScreen(tables, self.config, self.experiment_name)
|
|
25
|
+
)
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
from dirsql import DirSQL
|
|
4
|
+
from starlette.datastructures import QueryParams
|
|
5
|
+
from textual.app import ComposeResult
|
|
6
|
+
from textual.binding import Binding
|
|
7
|
+
from textual.screen import Screen
|
|
8
|
+
from textual.widgets import DataTable, Footer, Header
|
|
9
|
+
from textual.worker import Worker, WorkerState
|
|
10
|
+
|
|
11
|
+
from labnotes.load_experiment import load_experiment
|
|
12
|
+
from labnotes.models import LabnotesConfig
|
|
13
|
+
from labnotes.tui.invocation_columns import invocation_columns
|
|
14
|
+
from labnotes.tui.invocation_rows import invocation_rows
|
|
15
|
+
from labnotes.tui.runs_table import RunsTable
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ExperimentScreen(Screen[None]):
|
|
19
|
+
BINDINGS = [
|
|
20
|
+
Binding("space", "open_invocation", "Open invocation"),
|
|
21
|
+
Binding("escape", "app.pop_screen", "Back"),
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
def __init__(self, tables: DirSQL, config: LabnotesConfig, name: str) -> None:
|
|
25
|
+
super().__init__()
|
|
26
|
+
self.tables = tables
|
|
27
|
+
self.config = config
|
|
28
|
+
self.experiment_name = name
|
|
29
|
+
self.experiment: dict[str, Any] = {}
|
|
30
|
+
self.opened: set[str] = set()
|
|
31
|
+
|
|
32
|
+
def compose(self) -> ComposeResult:
|
|
33
|
+
yield Header()
|
|
34
|
+
yield RunsTable(id="runs", cursor_type="row")
|
|
35
|
+
yield Footer()
|
|
36
|
+
|
|
37
|
+
def on_mount(self) -> None:
|
|
38
|
+
self.sub_title = self.experiment_name
|
|
39
|
+
self.run_worker(self.load(), exit_on_error=False)
|
|
40
|
+
|
|
41
|
+
def on_worker_state_changed(self, event: Worker.StateChanged) -> None:
|
|
42
|
+
if event.state == WorkerState.ERROR:
|
|
43
|
+
self.app.exit(event.worker.error)
|
|
44
|
+
|
|
45
|
+
async def load(self) -> None:
|
|
46
|
+
loaded = await load_experiment(
|
|
47
|
+
self.tables,
|
|
48
|
+
self.config.root,
|
|
49
|
+
self.config.mode,
|
|
50
|
+
self.experiment_name,
|
|
51
|
+
QueryParams(),
|
|
52
|
+
)
|
|
53
|
+
if loaded is None:
|
|
54
|
+
raise ValueError(f"No experiment named {self.experiment_name}.")
|
|
55
|
+
self.experiment = loaded
|
|
56
|
+
self.sub_title = str(loaded["display_name"])
|
|
57
|
+
self.query_one(DataTable).add_columns(*invocation_columns(loaded))
|
|
58
|
+
self.redraw()
|
|
59
|
+
|
|
60
|
+
def redraw(self) -> None:
|
|
61
|
+
table = self.query_one(DataTable)
|
|
62
|
+
row = table.cursor_row
|
|
63
|
+
table.clear()
|
|
64
|
+
for key, cells in invocation_rows(self.experiment, self.opened):
|
|
65
|
+
table.add_row(*cells, key=key)
|
|
66
|
+
table.move_cursor(row=row)
|
|
67
|
+
|
|
68
|
+
def action_open_invocation(self) -> None:
|
|
69
|
+
table = self.query_one(DataTable)
|
|
70
|
+
if not table.row_count:
|
|
71
|
+
return
|
|
72
|
+
key = str(table.coordinate_to_cell_key(table.cursor_coordinate).row_key.value)
|
|
73
|
+
groups = {
|
|
74
|
+
group["name"]
|
|
75
|
+
for group in self.experiment["run_groups"] or ()
|
|
76
|
+
if not group["flat"]
|
|
77
|
+
}
|
|
78
|
+
if key in groups:
|
|
79
|
+
self.opened ^= {key}
|
|
80
|
+
self.redraw()
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
from dirsql import DirSQL
|
|
2
|
+
from textual.app import ComposeResult
|
|
3
|
+
from textual.screen import Screen
|
|
4
|
+
from textual.widgets import DataTable, Footer, Header
|
|
5
|
+
from textual.worker import Worker, WorkerState
|
|
6
|
+
|
|
7
|
+
from labnotes.models import LabnotesConfig
|
|
8
|
+
from labnotes.tables.summarize_experiments import summarize_experiments
|
|
9
|
+
from labnotes.tui.experiment_screen import ExperimentScreen
|
|
10
|
+
from labnotes.tui.runs_table import RunsTable
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ExperimentsScreen(Screen[None]):
|
|
14
|
+
def __init__(self, tables: DirSQL, config: LabnotesConfig) -> None:
|
|
15
|
+
super().__init__()
|
|
16
|
+
self.tables = tables
|
|
17
|
+
self.config = config
|
|
18
|
+
|
|
19
|
+
def compose(self) -> ComposeResult:
|
|
20
|
+
yield Header()
|
|
21
|
+
yield RunsTable(id="experiments", cursor_type="row")
|
|
22
|
+
yield Footer()
|
|
23
|
+
|
|
24
|
+
def on_mount(self) -> None:
|
|
25
|
+
self.run_worker(self.load(), exit_on_error=False)
|
|
26
|
+
|
|
27
|
+
def on_worker_state_changed(self, event: Worker.StateChanged) -> None:
|
|
28
|
+
if event.state == WorkerState.ERROR:
|
|
29
|
+
self.app.exit(event.worker.error)
|
|
30
|
+
|
|
31
|
+
async def load(self) -> None:
|
|
32
|
+
rows = await summarize_experiments(self.tables)
|
|
33
|
+
if not rows:
|
|
34
|
+
self.sub_title = "No experiments."
|
|
35
|
+
return
|
|
36
|
+
table = self.query_one(DataTable)
|
|
37
|
+
table.add_columns(*rows[0])
|
|
38
|
+
for row in rows:
|
|
39
|
+
table.add_row(
|
|
40
|
+
*("" if value is None else str(value) for value in row.values()),
|
|
41
|
+
key=str(row["name"]),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
def on_data_table_row_selected(self, event: DataTable.RowSelected) -> None:
|
|
45
|
+
self.app.push_screen(
|
|
46
|
+
ExperimentScreen(self.tables, self.config, str(event.row_key.value))
|
|
47
|
+
)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from collections.abc import Mapping, Sequence
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
from rich.text import Text
|
|
5
|
+
|
|
6
|
+
from labnotes.format_value import format_value
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def group_cells(
|
|
10
|
+
group: Mapping[str, Any], columns: Sequence[str], live: bool
|
|
11
|
+
) -> list[object]:
|
|
12
|
+
status = Text.assemble(
|
|
13
|
+
(f"{group['passed']}✓", "green"), " ", (f"{group['failed']}✕", "red")
|
|
14
|
+
)
|
|
15
|
+
if group["unfinished"]:
|
|
16
|
+
mark, style = ("◐", "yellow") if live else ("–", "dim")
|
|
17
|
+
status.append(f" {group['unfinished']}{mark}", style=style)
|
|
18
|
+
cells: list[object] = [status, group["name"], str(len(group["runs"]))]
|
|
19
|
+
for column in columns[1:]:
|
|
20
|
+
if column == "started":
|
|
21
|
+
cells.append(group["started"] or "")
|
|
22
|
+
elif column in group["shared"]:
|
|
23
|
+
cells.append(format_value(group["shared"][column]))
|
|
24
|
+
else:
|
|
25
|
+
cells.append("")
|
|
26
|
+
return cells
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def invocation_columns(experiment: Mapping[str, Any]) -> list[str]:
|
|
6
|
+
columns = ["", *experiment["run_columns"]]
|
|
7
|
+
if experiment["run_groups"] is not None:
|
|
8
|
+
columns.insert(2, "runs")
|
|
9
|
+
return columns
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from collections.abc import Collection, Mapping
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
from labnotes.tui.group_cells import group_cells
|
|
5
|
+
from labnotes.tui.run_cells import run_cells
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def invocation_rows(
|
|
9
|
+
experiment: Mapping[str, Any], opened: Collection[str]
|
|
10
|
+
) -> list[tuple[str, list[object]]]:
|
|
11
|
+
columns = experiment["run_columns"]
|
|
12
|
+
live = experiment["runs_live"]
|
|
13
|
+
groups = experiment["run_groups"]
|
|
14
|
+
if groups is None:
|
|
15
|
+
return [
|
|
16
|
+
(str(run["id"]), run_cells(run, columns, False, live))
|
|
17
|
+
for run in experiment["runs_list"]
|
|
18
|
+
]
|
|
19
|
+
rows = []
|
|
20
|
+
for group in groups:
|
|
21
|
+
if group["flat"]:
|
|
22
|
+
[run, *_] = group["runs"]
|
|
23
|
+
rows.append((str(run["id"]), run_cells(run, columns, True, live)))
|
|
24
|
+
continue
|
|
25
|
+
rows.append((group["name"], group_cells(group, columns, live)))
|
|
26
|
+
if group["name"] in opened:
|
|
27
|
+
rows += [
|
|
28
|
+
(str(run["id"]), run_cells(run, columns, True, live))
|
|
29
|
+
for run in group["runs"]
|
|
30
|
+
]
|
|
31
|
+
return rows
|
|
@@ -23,6 +23,8 @@ PENDING, PASSED, FAILED = "○", "✓", "✗"
|
|
|
23
23
|
SPINNER = "|/-\\"
|
|
24
24
|
SKIPPED, DESELECTED = "–", "⊘"
|
|
25
25
|
VIEWING_ACTIONS = {"leave", "quit", "interrupt", "command_palette"}
|
|
26
|
+
GRABBED_ACTIONS = {"shift", "drop", "put_back"}
|
|
27
|
+
GRABBING_ACTIONS = {*GRABBED_ACTIONS, "grab", "quit", "interrupt", "command_palette"}
|
|
26
28
|
|
|
27
29
|
|
|
28
30
|
class RunApp(App[None]):
|
|
@@ -30,6 +32,11 @@ class RunApp(App[None]):
|
|
|
30
32
|
BINDINGS = [
|
|
31
33
|
Binding("ctrl+c", "interrupt", "Stop runs"),
|
|
32
34
|
Binding("n", "run_next", "Run next"),
|
|
35
|
+
Binding("m", "grab", "Move"),
|
|
36
|
+
Binding("j,down", "shift(1)", priority=True),
|
|
37
|
+
Binding("k,up", "shift(-1)", priority=True),
|
|
38
|
+
Binding("enter", "drop", "Drop", priority=True),
|
|
39
|
+
Binding("escape", "put_back", "Put back"),
|
|
33
40
|
Binding("space", "toggle_run", "Deselect"),
|
|
34
41
|
Binding("D", "deselect_shown", "Deselect shown"),
|
|
35
42
|
Binding("x", "kill_run", "Stop run"),
|
|
@@ -56,6 +63,7 @@ class RunApp(App[None]):
|
|
|
56
63
|
lambda run: None,
|
|
57
64
|
lambda run: None,
|
|
58
65
|
lambda: None,
|
|
66
|
+
lambda run, place: None,
|
|
59
67
|
)
|
|
60
68
|
self.concurrency = 1
|
|
61
69
|
self.idle = False
|
|
@@ -70,6 +78,8 @@ class RunApp(App[None]):
|
|
|
70
78
|
self.hiding = False
|
|
71
79
|
self.folders: dict[str, Path] = {}
|
|
72
80
|
self.viewing: str | None = None
|
|
81
|
+
self.grabbed: str | None = None
|
|
82
|
+
self.grabbed_from: list[str] = []
|
|
73
83
|
self.offsets: dict[str, int]
|
|
74
84
|
self.decoders = {
|
|
75
85
|
stream: codecs.getincrementaldecoder("utf-8")(errors="replace")
|
|
@@ -129,6 +139,8 @@ class RunApp(App[None]):
|
|
|
129
139
|
case "adhoc", [only]:
|
|
130
140
|
self.view(only["run"]) # type: ignore[index]
|
|
131
141
|
case "started":
|
|
142
|
+
if run == self.grabbed:
|
|
143
|
+
self.action_put_back()
|
|
132
144
|
self.idle = False
|
|
133
145
|
self.pending.discard(run)
|
|
134
146
|
self.started[run] = time.monotonic()
|
|
@@ -158,10 +170,10 @@ class RunApp(App[None]):
|
|
|
158
170
|
del self.started[run]
|
|
159
171
|
self.redraw(table.cursor_row)
|
|
160
172
|
case "queued":
|
|
161
|
-
self.
|
|
162
|
-
table.move_cursor(row=table.get_row_index(run))
|
|
163
|
-
self.show(describe_event(event))
|
|
173
|
+
self.reposition(event, run)
|
|
164
174
|
self.next_run = run
|
|
175
|
+
case "moved":
|
|
176
|
+
self.reposition(event, run)
|
|
165
177
|
case "deselected":
|
|
166
178
|
self.pending.discard(run)
|
|
167
179
|
self.set_cell(run, "status", dim(DESELECTED))
|
|
@@ -198,7 +210,14 @@ class RunApp(App[None]):
|
|
|
198
210
|
passed = len(self.ended) - failed
|
|
199
211
|
self.show(f"{passed} passed, {failed} failed. q to quit.")
|
|
200
212
|
|
|
213
|
+
def reposition(self, event: dict[str, object], run: str) -> None:
|
|
214
|
+
table = self.query_one(DataTable)
|
|
215
|
+
self.reorder(event, table.cursor_row)
|
|
216
|
+
table.move_cursor(row=table.get_row_index(run))
|
|
217
|
+
self.show(describe_event(event))
|
|
218
|
+
|
|
201
219
|
def reorder(self, event: dict[str, object], row: int) -> None:
|
|
220
|
+
self.release()
|
|
202
221
|
waiting: list[str] = [*event["pending"], *event["held"]] # type: ignore[misc]
|
|
203
222
|
for run in waiting:
|
|
204
223
|
self.cells[run] = self.cells.pop(run)
|
|
@@ -220,6 +239,10 @@ class RunApp(App[None]):
|
|
|
220
239
|
table.update_cell(run, column, cell, update_width=True)
|
|
221
240
|
|
|
222
241
|
def check_action(self, action: str, parameters: tuple[object, ...]) -> bool:
|
|
242
|
+
if self.grabbed is not None:
|
|
243
|
+
return action in GRABBING_ACTIONS
|
|
244
|
+
if action in GRABBED_ACTIONS:
|
|
245
|
+
return False
|
|
223
246
|
return self.viewing is None or action in VIEWING_ACTIONS
|
|
224
247
|
|
|
225
248
|
def show_concurrency(self, event: dict[str, object]) -> None:
|
|
@@ -262,6 +285,57 @@ class RunApp(App[None]):
|
|
|
262
285
|
if (run := self.cursor_run()) is not None:
|
|
263
286
|
self.controls.run_next(run)
|
|
264
287
|
|
|
288
|
+
def queue(self) -> list[str]:
|
|
289
|
+
return [run for run in self.cells if run in self.pending]
|
|
290
|
+
|
|
291
|
+
def action_grab(self) -> None:
|
|
292
|
+
if self.grabbed is not None:
|
|
293
|
+
self.action_drop()
|
|
294
|
+
return
|
|
295
|
+
run = self.cursor_run()
|
|
296
|
+
if run not in self.pending:
|
|
297
|
+
return
|
|
298
|
+
self.grabbed = run
|
|
299
|
+
self.grabbed_from = list(self.cells)
|
|
300
|
+
self.refresh_bindings()
|
|
301
|
+
self.show(f"Moving {run}. j/k moves it, Enter drops it, Escape puts it back.")
|
|
302
|
+
|
|
303
|
+
def action_shift(self, step: int) -> None:
|
|
304
|
+
run = str(self.grabbed)
|
|
305
|
+
queue = self.queue()
|
|
306
|
+
place = queue.index(run) + step
|
|
307
|
+
if place not in range(len(queue)):
|
|
308
|
+
return
|
|
309
|
+
order = list(self.cells)
|
|
310
|
+
here, there = order.index(run), order.index(queue[place])
|
|
311
|
+
order[here], order[there] = order[there], order[here]
|
|
312
|
+
self.cells = {key: self.cells[key] for key in order}
|
|
313
|
+
self.redraw_on(run)
|
|
314
|
+
|
|
315
|
+
def action_drop(self) -> None:
|
|
316
|
+
run = str(self.grabbed)
|
|
317
|
+
self.release()
|
|
318
|
+
self.show("")
|
|
319
|
+
self.controls.move(run, self.queue().index(run))
|
|
320
|
+
|
|
321
|
+
def action_put_back(self) -> None:
|
|
322
|
+
run = str(self.grabbed)
|
|
323
|
+
self.release()
|
|
324
|
+
places = {key: place for place, key in enumerate(self.grabbed_from)}
|
|
325
|
+
ordered = sorted(self.cells, key=lambda key: places.get(key, len(places)))
|
|
326
|
+
self.cells = {key: self.cells[key] for key in ordered}
|
|
327
|
+
self.redraw_on(run)
|
|
328
|
+
self.show("")
|
|
329
|
+
|
|
330
|
+
def release(self) -> None:
|
|
331
|
+
self.grabbed = None
|
|
332
|
+
self.refresh_bindings()
|
|
333
|
+
|
|
334
|
+
def redraw_on(self, run: str) -> None:
|
|
335
|
+
table = self.query_one(DataTable)
|
|
336
|
+
self.redraw(table.cursor_row)
|
|
337
|
+
table.move_cursor(row=table.get_row_index(run))
|
|
338
|
+
|
|
265
339
|
def action_toggle_run(self) -> None:
|
|
266
340
|
if (run := self.cursor_run()) is not None:
|
|
267
341
|
self.controls.toggle(run)
|
|
@@ -294,7 +368,8 @@ class RunApp(App[None]):
|
|
|
294
368
|
field.focus()
|
|
295
369
|
|
|
296
370
|
def on_data_table_row_selected(self, event: DataTable.RowSelected) -> None:
|
|
297
|
-
self.
|
|
371
|
+
if self.grabbed is None:
|
|
372
|
+
self.view(str(event.row_key.value))
|
|
298
373
|
|
|
299
374
|
def view(self, run: str) -> None:
|
|
300
375
|
self.viewing = run
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from collections.abc import Mapping, Sequence
|
|
2
|
+
|
|
3
|
+
from rich.text import Text
|
|
4
|
+
|
|
5
|
+
from labnotes.format_duration import format_duration
|
|
6
|
+
from labnotes.format_value import format_value
|
|
7
|
+
from labnotes.tui.dim import dim
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def run_cells(
|
|
11
|
+
run: Mapping[str, object], columns: Sequence[str], nested: bool, live: bool
|
|
12
|
+
) -> list[object]:
|
|
13
|
+
if run["labnotes_unfinished"]:
|
|
14
|
+
status = Text("◐", style="yellow") if live else dim("–")
|
|
15
|
+
elif run["labnotes_completed"]:
|
|
16
|
+
status = Text("✓", style="green")
|
|
17
|
+
else:
|
|
18
|
+
status = Text("✕", style="red")
|
|
19
|
+
cells: list[object] = [status]
|
|
20
|
+
for column in columns:
|
|
21
|
+
value = run[column]
|
|
22
|
+
if column == "id" and nested:
|
|
23
|
+
child = str(value).partition("/")[2]
|
|
24
|
+
cells += [f" {child}" if child else str(value), ""]
|
|
25
|
+
elif column == "duration":
|
|
26
|
+
cells.append(format_duration(value)) # type: ignore[arg-type]
|
|
27
|
+
else:
|
|
28
|
+
cells.append(format_value(value))
|
|
29
|
+
return cells
|
|
@@ -45,3 +45,27 @@ path = "src/labnotes/run_control.py"
|
|
|
45
45
|
rules = ["mutation"]
|
|
46
46
|
lines = [38]
|
|
47
47
|
reason = "argument counts are small ints, which CPython caches, so is not equals !="
|
|
48
|
+
|
|
49
|
+
[[python.exempt]]
|
|
50
|
+
path = "src/labnotes/tui/run_cells.py"
|
|
51
|
+
rules = ["mutation"]
|
|
52
|
+
lines = [22, 25]
|
|
53
|
+
reason = "run columns come from string literals in load_experiment, which CPython interns, so is equals =="
|
|
54
|
+
|
|
55
|
+
[[python.exempt]]
|
|
56
|
+
path = "src/labnotes/tui/group_cells.py"
|
|
57
|
+
rules = ["mutation"]
|
|
58
|
+
lines = [20]
|
|
59
|
+
reason = "run columns come from string literals in load_experiment, which CPython interns, so is equals =="
|
|
60
|
+
|
|
61
|
+
[[python.exempt]]
|
|
62
|
+
path = "src/labnotes/tui/experiment_screen.py"
|
|
63
|
+
rules = ["mutation"]
|
|
64
|
+
lines = [42]
|
|
65
|
+
reason = "WorkerState members are singletons, so is equals =="
|
|
66
|
+
|
|
67
|
+
[[python.exempt]]
|
|
68
|
+
path = "src/labnotes/tui/experiments_screen.py"
|
|
69
|
+
rules = ["mutation"]
|
|
70
|
+
lines = [28, 37]
|
|
71
|
+
reason = "WorkerState members are singletons, so is equals ==; every row of one query has the same keys, so any row names the columns"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|