Skip to content

Commit

Permalink
ios package: extract/move pub types; 'show job --help'
Browse files Browse the repository at this point in the history
* up cli
* part two, prev commit: 04551c0
* separately, 'ais show job':
  - add inline help; docs

Signed-off-by: Alex Aizman <[email protected]>
  • Loading branch information
alex-aizman committed Dec 12, 2024
1 parent 5c0165a commit 11011d6
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 14 deletions.
5 changes: 2 additions & 3 deletions cmd/cli/cli/disk.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/NVIDIA/aistore/cmn/debug"
"github.com/NVIDIA/aistore/core/meta"
"github.com/NVIDIA/aistore/fs"
"github.com/NVIDIA/aistore/ios"
jsoniter "github.com/json-iterator/go"
"github.com/urfave/cli"
"golang.org/x/sync/errgroup"
Expand All @@ -26,7 +25,7 @@ import (
type (
dstats struct {
tid string
stats ios.AllDiskStats
stats cos.AllDiskStats
tcdf *fs.Tcdf
}
dstatsCtx struct {
Expand All @@ -52,7 +51,7 @@ func (ctx *dstatsCtx) get() error {
}

// 3. v3.23 and older
var stats ios.AllDiskStats
var stats cos.AllDiskStats
err = jsoniter.Unmarshal(out, &stats)
if err != nil {
return err
Expand Down
17 changes: 16 additions & 1 deletion cmd/cli/cli/show_hdlr.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@ import (
"github.com/urfave/cli"
)

const showJobUsage = "show running and/or finished jobs\n" +
indent1 + "\t- 'show job tco-cysbohAGL'\t- show a given (multi-object copy/transform) job identified by its unique ID;\n" +
indent1 + "\t- 'show job copy-listrange'\t- show all running multi-object copies;\n" +
indent1 + "\t- 'show job copy-objects'\t- same as above (using display name);\n" +
indent1 + "\t- 'show job copy-objects --all'\t- show both running and already finished (or stopped) multi-object copies;\n" +
indent1 + "\t- 'show job list'\t- show all running list-objects jobs;\n" +
indent1 + "\t- 'show job ls'\t- same as above;\n" +
indent1 + "\t- 'show job ls --refresh 10'\t- same as above with periodic _refreshing_ every 10 seconds;\n" +
indent1 + "\t- 'show job ls --refresh 10 --count 4'\t- same as above but only for the first four 10-seconds intervals;\n" +
indent1 + "\t- 'show job prefetch-listrange'\t- show all running prefetch jobs;\n" +
indent1 + "\t- 'show job prefetch'\t- same as above;\n" +
indent1 + "\t- 'show job prefetch --refresh 1m'\t- show all running prefetch jobs at 1 minute intervals (until Ctrl-C);\n" +
indent1 + "\t- 'show job --all'\t- show absolutely all jobs, running and already finished\n" +
indent1 + tabHelpOpt + "."

type (
daemonTemplateXactSnaps struct {
DaemonID string
Expand Down Expand Up @@ -198,7 +213,7 @@ var (

showCmdJob = cli.Command{
Name: commandJob,
Usage: "show running and finished jobs ('--all' for all, or " + tabHelpOpt + ")",
Usage: showJobUsage,
ArgsUsage: jobAnyArg,
Flags: showCmdsFlags[commandJob],
Action: showJobsHandler,
Expand Down
3 changes: 1 addition & 2 deletions cmd/cli/cli/storage_hdlr.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"github.com/NVIDIA/aistore/cmn/debug"
"github.com/NVIDIA/aistore/cmn/mono"
"github.com/NVIDIA/aistore/core/meta"
"github.com/NVIDIA/aistore/ios"
"github.com/NVIDIA/aistore/sys"
"github.com/NVIDIA/aistore/xact"
"github.com/urfave/cli"
Expand Down Expand Up @@ -670,7 +669,7 @@ func mpathAction(c *cli.Context, action string) error {
case apc.ActMountpathAttach:
acted = "attached"
label := parseStrFlag(c, mountpathLabelFlag)
err = api.AttachMountpath(apiBP, si, mountpath, ios.Label(label))
err = api.AttachMountpath(apiBP, si, mountpath, cos.MountpathLabel(label))
case apc.ActMountpathEnable:
acted = "enabled"
err = api.EnableMountpath(apiBP, si, mountpath)
Expand Down
2 changes: 1 addition & 1 deletion cmd/cli/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/NVIDIA/aistore/cmd/cli
go 1.23.2

require (
github.com/NVIDIA/aistore v1.3.26-0.20241211162240-ea3e9a86b1e6
github.com/NVIDIA/aistore v1.3.26-0.20241212193220-5c0165ae5b52
github.com/fatih/color v1.18.0
github.com/json-iterator/go v1.1.12
github.com/onsi/ginkgo/v2 v2.21.0
Expand Down
4 changes: 2 additions & 2 deletions cmd/cli/go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
code.cloudfoundry.org/bytefmt v0.0.0-20190710193110-1eb035ffe2b6/go.mod h1:wN/zk7mhREp/oviagqUXY3EwuHhWyOvAdsn5Y4CzOrc=
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/NVIDIA/aistore v1.3.26-0.20241211162240-ea3e9a86b1e6 h1:t2E/lsS4VIu9ah5fskW+5gsknRlGStlJ9JtKN55ouO0=
github.com/NVIDIA/aistore v1.3.26-0.20241211162240-ea3e9a86b1e6/go.mod h1:/6lHPQptxjseMk9B2Zv3wcFkXsyZdr4YCsbfjzHe7r8=
github.com/NVIDIA/aistore v1.3.26-0.20241212193220-5c0165ae5b52 h1:1xjtRDw2e5avssCqnOw1v3JbWL31Bg5QQw/McJWTuoU=
github.com/NVIDIA/aistore v1.3.26-0.20241212193220-5c0165ae5b52/go.mod h1:qQHBeoY+zUxx3nrxo7lOoQd4x/LxzQD7So/oV9G4t8w=
github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8=
github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q=
github.com/VividCortex/ewma v1.1.1/go.mod h1:2Tkkvm3sRDVXaiyucHiACn4cqf7DpdyLvmxzcbUokwA=
Expand Down
3 changes: 1 addition & 2 deletions cmd/cli/teb/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import (
"github.com/NVIDIA/aistore/cmn/debug"
"github.com/NVIDIA/aistore/core/meta"
"github.com/NVIDIA/aistore/fs"
"github.com/NVIDIA/aistore/ios"
"github.com/NVIDIA/aistore/stats"
"github.com/urfave/cli"
)
Expand Down Expand Up @@ -351,7 +350,7 @@ type (
DiskStatsHelper struct {
TargetID string
DiskName string
Stat ios.DiskStats
Stat cos.DiskStats
Tcdf *fs.Tcdf
}
SmapHelper struct {
Expand Down
2 changes: 1 addition & 1 deletion cmd/ishard/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/NVIDIA/aistore/cmd/ishard
go 1.23.2

require (
github.com/NVIDIA/aistore v1.3.26-0.20241211162240-ea3e9a86b1e6
github.com/NVIDIA/aistore v1.3.26-0.20241212193220-5c0165ae5b52
github.com/json-iterator/go v1.1.12
github.com/vbauerster/mpb/v4 v4.12.2
)
Expand Down
4 changes: 2 additions & 2 deletions cmd/ishard/go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
code.cloudfoundry.org/bytefmt v0.0.0-20190710193110-1eb035ffe2b6/go.mod h1:wN/zk7mhREp/oviagqUXY3EwuHhWyOvAdsn5Y4CzOrc=
github.com/NVIDIA/aistore v1.3.26-0.20241211162240-ea3e9a86b1e6 h1:t2E/lsS4VIu9ah5fskW+5gsknRlGStlJ9JtKN55ouO0=
github.com/NVIDIA/aistore v1.3.26-0.20241211162240-ea3e9a86b1e6/go.mod h1:/6lHPQptxjseMk9B2Zv3wcFkXsyZdr4YCsbfjzHe7r8=
github.com/NVIDIA/aistore v1.3.26-0.20241212193220-5c0165ae5b52 h1:1xjtRDw2e5avssCqnOw1v3JbWL31Bg5QQw/McJWTuoU=
github.com/NVIDIA/aistore v1.3.26-0.20241212193220-5c0165ae5b52/go.mod h1:qQHBeoY+zUxx3nrxo7lOoQd4x/LxzQD7So/oV9G4t8w=
github.com/OneOfOne/xxhash v1.2.8 h1:31czK/TI9sNkxIKfaUfGlU47BAxQ0ztGgd9vPyqimf8=
github.com/OneOfOne/xxhash v1.2.8/go.mod h1:eZbhyaAYD41SGSSsnmcpxVoRiQ/MPUTjUdIIOT9Um7Q=
github.com/VividCortex/ewma v1.1.1 h1:MnEK4VOv6n0RSY4vtRe3h11qjxL3+t0B8yOL8iMXdcM=
Expand Down
41 changes: 41 additions & 0 deletions docs/cli/show.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,47 @@ Use `ais show performance` and its variations in combination with `ais show job`

## `ais show job`

```console
$ ais show job --help
NAME:
ais show job - show running and/or finished jobs
- 'show job tco-cysbohAGL' - show a given (multi-object copy/transform) job identified by its unique ID;
- 'show job copy-listrange' - show all running multi-object copies;
- 'show job copy-objects' - same as above (using display name);
- 'show job copy-objects --all' - show both running and already finished (or stopped) multi-object copies;
- 'show job list' - show all running list-objects jobs;
- 'show job ls' - same as above;
- 'show job ls --refresh 10' - same as above with periodic _refreshing_ every 10 seconds;
- 'show job ls --refresh 10 --count 4' - same as above but only for the first four 10-seconds intervals;
- 'show job prefetch-listrange' - show all running prefetch jobs;
- 'show job prefetch' - same as above;
- 'show job prefetch --refresh 1m' - show all running prefetch jobs at 1 minute intervals (until Ctrl-C);
- 'show job --all' - show absolutely all jobs, running and already finished
press <TAB-TAB> to select, '--help' for more options.

USAGE:
ais show job [command options] [NAME] [JOB_ID] [NODE_ID] [BUCKET]

OPTIONS:
--refresh value time interval for continuous monitoring; can be also used to update progress bar (at a given interval);
valid time units: ns, us (or µs), ms, s (default), m, h
--count value used together with '--refresh' to limit the number of generated reports, e.g.:
'--refresh 10 --count 5' - run 5 times with 10s interval (default: 0)
--json, -j json input/output
--all all jobs, including finished and aborted
--regex value regular expression to select jobs by name, kind, or description, e.g.: --regex "ec|mirror|elect"
--no-headers, -H display tables without headers
--verbose, -v show extended statistics
--units value show statistics and/or parse command-line specified sizes using one of the following _units of measurement_:
iec - IEC format, e.g.: KiB, MiB, GiB (default)
si - SI (metric) format, e.g.: KB, MB, GB
raw - do not convert to (or from) human-readable format
--date-time override the default hh:mm:ss (hours, minutes, seconds) time format - include calendar date as well
--progress show progress bar(s) and progress of execution in real time
--log value filename to log metrics (statistics)
--help, -h show help
```

The command has no statically defined subcommands. When you type `ais show job <TAB-TAB>`, the resulting set of shell completions will only include job names (aka "kinds") that are **currently running**. Example:

```console
Expand Down

0 comments on commit 11011d6

Please sign in to comment.