Skip to content

ls: --sort-by FIELDS #433

Description

@yarikoptic

ATM we have --eval-filter which can filter based on python expression.

dandi@drogon:~$ echo $TERM
screen.xterm-256color
dandi@drogon:~$ con-duct ls --help
usage: con-duct <command> [options] ls [-h] [-f {auto,pyout,summaries,json,json_pp,yaml}] [-F FIELD [FIELD ...]] [--colors] [-e EVAL_FILTER] [paths ...]

positional arguments:
  paths                 Path to duct report files, only `info.json` would be considered. If not provided, the program will glob for files that match
                        DUCT_OUTPUT_PREFIX.

options:
  -h, --help            show this help message and exit
  -f, --format {auto,pyout,summaries,json,json_pp,yaml}
                        Output format. TODO Fixme. 'auto' chooses 'pyout' if pyout library is installed, 'summaries' otherwise.
  -F, --fields FIELD [FIELD ...]
                        List of fields to show. Prefix is always included implicitly as the first field. Available choices: average_pcpu, average_pmem,
                        average_rss, average_vsz, command, cpu_total, duct_version, end_time, exit_code, gpu, hostname, info, logs_prefix, memory_total,
                        num_reports, num_samples, peak_pcpu, peak_pmem, peak_rss, peak_vsz, prefix, schema_version, start_time, stderr, stdout, uid, usage,
                        user, wall_clock_time.
  --colors              Use colors in duct output.
  -e, --eval-filter EVAL_FILTER
                        Python expression to filter results based on available fields. The expression is evaluated for each entry, and only those that return
                        True are included. See --fields for all supported fields. Example: --eval-filter "filter_this=='yes'" filters entries where
                        'filter_this' is 'yes'. You can use 're' for regex operations (e.g., --eval-filter "re.search('2025.02.09.*', prefix)").

but no way to sort and i do get them unsorted

dandi@drogon:~$ con-duct ls
PREFIX                                  COMMAND                                                                                 EXIT_CODE WALL_CLOCK_TIME PEAK_RSS
.duct/logs/2026.05.25T14.30.01-1338355_ bash -c /mnt/backup/dandi/dandisets/tools/backups2datalad-update-cron                   0         149.905 sec     180.6 MB
.duct/logs/2026.05.21T15.15.01-1855868_ bash -c /mnt/backup/dandi/dandisets/tools/backups2datalad-update-cron                   0         258.399 sec     364.9 MB
.duct/logs/2026.05.25T01.45.01-298990_  bash -c /mnt/backup/dandi/dandisets/tools/backups2datalad-update-cron                   0         91.214 sec      163.5 MB
...
.duct/logs/2026.05.25T09.00.01-3349343_ bash -c /mnt/backup/dandi/dandisets/tools/backups2datalad-update-cron                   0         95.127 sec      167.7 MB
.duct/logs/2026.05.27T19.00.01-2536299_ bash -c /mnt/backup/dandi/dandisets/tools/backups2datalad-update-cron                   1         1116.382 sec    181.1 MB
.duct/logs/2026.05.24T01.15.01-3506610_ bash -c /mnt/backup/dandi/dandisets/tools/backups2datalad-update-cron                   0         107.934 sec     442.3 MB
.duct/logs/2026.05.25T21.00.01-3743690_ bash -c /mnt/backup/dandi/dandisets/tools/backups2datalad-update-cron                   0         469.157 sec     179.2 MB

I think it would be logical to ask for e.g. --sort-by logs_prefix or --sort-by command,logs_prefix or alike.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions