Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --short option. #38

Merged
merged 15 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ step2 0 0 4 96 800 GPU-hours
```

```bash
$ row show directories step1 -n 3 --value="/value"
$ row show directories --action step1 -n 3 --value="/value"
Directory Status Job ID /value
dir1 completed 116
dir10 completed 952
Expand Down
2 changes: 1 addition & 1 deletion demo/demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ row submit --action=step1 -n 1 --yes || exit 1

row show status || exit 1

row show directories step1 -n 3 --value="/value"
row show directories --action step1 -n 3 --value="/value"
1 change: 1 addition & 0 deletions doc/src/contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ The following people have contributed to the development of **row**:
* Joshua A. Anderson, University of Michigan
* Jen Bradley, University of Michigan
* Joseph Burkhart, University of Michigan
* Tim Moore, University of Michigan
10 changes: 5 additions & 5 deletions doc/src/guide/tutorial/group.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ cd ..
cp ../group-workflow2.toml workflow.toml

# ANCHOR: show_point1
row show directories process_point --value /type --value /x --value /y
row show directories --action process_point --value /type --value /x --value /y
# ANCHOR_END: show_point1

# ANCHOR: show_letter
row show directories process_letter --value /type --value /letter
row show directories --action process_letter --value /type --value /letter
# ANCHOR_END: show_letter

cp ../group-workflow3.toml workflow.toml

# ANCHOR: show_point2
row show directories process_point --value /type --value /x --value /y
row show directories --action process_point --value /type --value /x --value /y
# ANCHOR_END: show_point2

cp ../group-workflow4.toml workflow.toml

# ANCHOR: show_point3
row show directories process_point --value /type --value /x --value /y
row show directories --action process_point --value /type --value /x --value /y
# ANCHOR_END: show_point3

# ANCHOR: submit
Expand All @@ -46,5 +46,5 @@ row submit -a process_point
cp ../group-workflow5.toml workflow.toml

# ANCHOR: show_point4
row show directories process_point --value /type --value /x --value /y
row show directories --action process_point --value /type --value /x --value /y
# ANCHOR_END: show_point4
2 changes: 1 addition & 1 deletion doc/src/guide/tutorial/hello.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ row submit directory1
# ANCHOR_END: submit2

# ANCHOR: directories_hello
row show directories hello
row show directories --action hello
# ANCHOR_END: directories_hello

# ANCHOR: submit3
Expand Down
2 changes: 1 addition & 1 deletion doc/src/guide/tutorial/submit.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ hello 0 3 0 0 3 CPU-hours

Similarly,
```bash
row show directories hello
row show directories --action hello
```
will show something like:
```plaintext
Expand Down
4 changes: 4 additions & 0 deletions doc/src/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* New arguments to `show status` display actions that are in the requested states:
`--completed`, `--eligible`, `--submitted`, and `--waiting`.
* `cluster.submit_options` configuration option in `clusters.toml`.
* `--short` option to `show launchers` and `show directories`.

*Changed:*

Expand All @@ -18,10 +19,13 @@
* `clean` now cleans all caches by default.
* Submit jobs with `--constraint="scratch"` by default on Delta.
* Submit jobs with `--constraint="nvme"` by default on Frontier.
* Change `--name` option of `show cluster` to `--short`.
* `show directories` now accepts an optional `--action` argument.

*Fixed:*

* `submit_whole = true` checks only directories that match `group.include`.
* Do not print trailing spaces after the final column in tabular output.

## 0.2.0 (2024-06-18)

Expand Down
4 changes: 2 additions & 2 deletions doc/src/row/show/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ Print the [current cluster configuration](../../clusters/index.md) in TOML forma

Show the configuration of all clusters: both user-defined and built-in.

### `--name`
### `--short`

Show only the cluster's name.
Show only the name of the matching cluster(s).

## Examples

Expand Down
34 changes: 26 additions & 8 deletions doc/src/row/show/directories.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

Usage:
```bash
row show directories [OPTIONS] <ACTION> [DIRECTORIES]
row show directories [OPTIONS] [DIRECTORIES]
```

`row show directories` lists each selected directory with its
`row show directories` lists each selected directory.

When provided an action, `row show directories` also shows each directory's
[status](../../guide/concepts/status.md) and scheduler job ID (when submitted) for the
given `<ACTION>`. You can also show elements from the directory's value, accessed by
given action. You can also show elements from the directory's value, accessed by
[JSON pointer](../../guide/concepts/json-pointers.md). Blank lines separate
[groups](../../workflow/action/group.md).

Expand All @@ -22,11 +24,15 @@ the action's [include condition](../../workflow/action/group.md#include)

Pass a single `-` to read the directories from stdin (separated by newlines):
```bash
echo "dir1" | row show directories action -
echo "dir1" | row show directories [OPTIONS] -
```

## `[OPTIONS]`

### `--action`

Select directories that are included by the provided action.

### `--completed`

Show directories with the *completed* status.
Expand All @@ -49,6 +55,10 @@ Hide the header in the output.

Do not write blank lines between groups.

### `--short`

Show only the directory names.

### `--submitted`

Show directories with the *submitted* status.
Expand All @@ -67,17 +77,25 @@ Show directories with the *waiting* status.

* Show all the directories for action `one`:
```bash
row show directories one
row show directories --action one
```
* Show the directory value element `/value`:
```bash
row show directories action --value=/value
row show directories --action action --value=/value
```
* Show specific directories:
```bash
row show directories action directory1 directory2
row show directories --action action directory1 directory2
```
* Show eligible directories
```bash
row show directories action --eligible
row show directories --action action --eligible
```
* Show the names of all directories
```bash
row show directories
```
* Show the names of eligible directories
```bash
row show directories --action action --eligible --short
```
8 changes: 8 additions & 0 deletions doc/src/row/show/launchers.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ and the built-in launchers.

Show the launcher configurations for all clusters.

### `--short`

Show only the names of the launchers.

## Examples

* Show the launchers for the autodetected cluster:
Expand All @@ -31,3 +35,7 @@ Show the launcher configurations for all clusters.
```bash
row show launchers --all
```
* Show only names of all launchers:
```bash
row show launchers --all --short
```
2 changes: 1 addition & 1 deletion doc/src/row/submit.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ row submit [OPTIONS] [DIRECTORIES]
actions. Then it forms [groups](../workflow/action/group.md) and submits one job for
each group. Pass `--dry-run` to see the script(s) that will be submitted. Execute
```
row show directories action --eligible
row show directories --action action --eligible
```
to see the specific directory groups that will be submitted.

Expand Down
2 changes: 1 addition & 1 deletion doc/src/signac-flow.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Commands:
| flow | row |
|------|-----|
| `project.py status` | [`row show status`](row/show/status.md) |
| `project.py status --detailed` | [`row show directories <ACTION>`](row/show/directories.md) |
| `project.py status --detailed` | [`row show directories --action action`](row/show/directories.md) |
| `project.py run` | [`row submit --cluster=none`](row/submit.md) |
| `project.py run --parallel` | A command *may* execute [group members][group] in [parallel]. |
| `project.py exec ...` | Execute your action's command in the shell. |
Expand Down
2 changes: 1 addition & 1 deletion doc/src/workflow/action/group.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ condition = ["/subproject", "==", "project_one"]

> Note: You may omit `[action.group]` entirely.

Execute [`row show directories <ACTION>`](../../row/show/directories.md) to display the
Execute [`row show directories --action action`](../../row/show/directories.md) to display the
groups of directories included in a given action.

## include
Expand Down
35 changes: 24 additions & 11 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,32 +102,42 @@ pub enum ShowCommands {

/// List directories in the workspace.
///
/// `row show directories` lists each selected directory with its status
/// and scheduler job ID (when submitted). for the given `<ACTION`>. You
/// can also show elements from the directory's value, accessed by JSON
/// pointer. Blank lines separate groups.
/// `row show directories` lists each selected directory.
///
/// By default, `row show status` displays directories with any status. Set
/// one or more of `--completed`, `--submitted`, `--eligible`, and
/// `--waiting` to show specific directories that have specific statuses.
/// When provided an action, `row show directories` also shows each
/// directory's status and scheduler job ID (when submitted) for the given
/// action. You can also show elements from the directory's value, accessed
/// by JSON pointer. Blank lines separate groups.
///
/// By default, `row show status` displays directories with any status. Set one or more
/// of `--completed`, `--submitted`, `--eligible`, and `--waiting` to show specific
/// directories that have specific statuses.
///
/// EXAMPLES
///
/// * Show all the directories for action `one`:
///
/// row show directories one
/// row show directories --action one
///
/// * Show the directory value element `/value`:
///
/// row show directories action --value=/value
/// row show directories --action action --value=/value
///
/// * Show specific directories:
///
/// row show directories action directory1 directory2
/// row show directories --action action directory1 directory2
///
/// * Show eligible directories
///
/// row show directories action --eligible
/// row show directories --action action --eligible
///
/// * Show the names of all directories
///
/// row show directories
///
/// * Show the names of eligible directories
///
/// row show directories --action action --eligible --short
///
Directories(directories::Arguments),

Expand Down Expand Up @@ -173,6 +183,9 @@ pub enum ShowCommands {
///
/// row show launchers --all
///
///* Show only names of all launchers:
///
/// row show launchers --all --short
Launchers(launchers::Arguments),
}

Expand Down
20 changes: 13 additions & 7 deletions src/cli/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ use row::cluster;
#[derive(Args, Debug)]
pub struct Arguments {
/// Show all clusters.
#[arg(long, group = "select", display_order = 0)]
#[arg(long, display_order = 0)]
all: bool,

/// Show only the autodetected cluster's name.
#[arg(long, group = "select", display_order = 0)]
name: bool,
/// Show only the cluster name(s).
#[arg(long, display_order = 0)]
short: bool,
}

/// Show the cluster.
Expand All @@ -34,13 +34,19 @@ pub fn cluster<W: Write>(
let clusters = cluster::Configuration::open()?;

if args.all {
info!("All cluster configurations:");
write!(output, "{}", &toml::to_string_pretty(&clusters)?)?;
if args.short {
for cluster in clusters.cluster {
writeln!(output, "{}", cluster.name)?;
}
} else {
info!("All cluster configurations:");
write!(output, "{}", &toml::to_string_pretty(&clusters)?)?;
}
} else {
let cluster = clusters.identify(options.cluster.as_deref())?;
info!("Cluster configurations for '{}':", cluster.name);

if args.name {
if args.short {
writeln!(output, "{}", cluster.name)?;
} else {
write!(output, "{}", &toml::to_string_pretty(&cluster)?)?;
Expand Down
Loading