From 11011d6fed6fc47654256f9f2a1e8b4e4bf3dc2a Mon Sep 17 00:00:00 2001 From: Alex Aizman Date: Thu, 12 Dec 2024 14:42:13 -0500 Subject: [PATCH] ios package: extract/move pub types; 'show job --help' * up cli * part two, prev commit: 04551c0f4395de * separately, 'ais show job': - add inline help; docs Signed-off-by: Alex Aizman --- cmd/cli/cli/disk.go | 5 ++--- cmd/cli/cli/show_hdlr.go | 17 ++++++++++++++- cmd/cli/cli/storage_hdlr.go | 3 +-- cmd/cli/go.mod | 2 +- cmd/cli/go.sum | 4 ++-- cmd/cli/teb/templates.go | 3 +-- cmd/ishard/go.mod | 2 +- cmd/ishard/go.sum | 4 ++-- docs/cli/show.md | 41 +++++++++++++++++++++++++++++++++++++ 9 files changed, 67 insertions(+), 14 deletions(-) diff --git a/cmd/cli/cli/disk.go b/cmd/cli/cli/disk.go index 4109644b373..bbe89b5653e 100644 --- a/cmd/cli/cli/disk.go +++ b/cmd/cli/cli/disk.go @@ -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" @@ -26,7 +25,7 @@ import ( type ( dstats struct { tid string - stats ios.AllDiskStats + stats cos.AllDiskStats tcdf *fs.Tcdf } dstatsCtx struct { @@ -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 diff --git a/cmd/cli/cli/show_hdlr.go b/cmd/cli/cli/show_hdlr.go index ab13b56fb0a..17ff3911ee0 100644 --- a/cmd/cli/cli/show_hdlr.go +++ b/cmd/cli/cli/show_hdlr.go @@ -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 @@ -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, diff --git a/cmd/cli/cli/storage_hdlr.go b/cmd/cli/cli/storage_hdlr.go index d851c353aa6..37d4c96b9b8 100644 --- a/cmd/cli/cli/storage_hdlr.go +++ b/cmd/cli/cli/storage_hdlr.go @@ -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" @@ -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) diff --git a/cmd/cli/go.mod b/cmd/cli/go.mod index 5033fb93ef7..17faf48a08b 100644 --- a/cmd/cli/go.mod +++ b/cmd/cli/go.mod @@ -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 diff --git a/cmd/cli/go.sum b/cmd/cli/go.sum index d8d8cab5541..f39b3bb64a6 100644 --- a/cmd/cli/go.sum +++ b/cmd/cli/go.sum @@ -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= diff --git a/cmd/cli/teb/templates.go b/cmd/cli/teb/templates.go index 99fc5ba3ee9..01d04437948 100644 --- a/cmd/cli/teb/templates.go +++ b/cmd/cli/teb/templates.go @@ -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" ) @@ -351,7 +350,7 @@ type ( DiskStatsHelper struct { TargetID string DiskName string - Stat ios.DiskStats + Stat cos.DiskStats Tcdf *fs.Tcdf } SmapHelper struct { diff --git a/cmd/ishard/go.mod b/cmd/ishard/go.mod index 9aef3a90e94..22823106a18 100644 --- a/cmd/ishard/go.mod +++ b/cmd/ishard/go.mod @@ -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 ) diff --git a/cmd/ishard/go.sum b/cmd/ishard/go.sum index 4962e0d5414..e400ab59cfc 100644 --- a/cmd/ishard/go.sum +++ b/cmd/ishard/go.sum @@ -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= diff --git a/docs/cli/show.md b/docs/cli/show.md index c297e6bdbc2..7ca47eb4099 100644 --- a/docs/cli/show.md +++ b/docs/cli/show.md @@ -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 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 `, the resulting set of shell completions will only include job names (aka "kinds") that are **currently running**. Example: ```console