From b2194924d02fa930ba50d7c46f6f06ae28bce44c Mon Sep 17 00:00:00 2001 From: Mahendra Paipuri Date: Sat, 11 Jul 2026 11:26:15 +0200 Subject: [PATCH] feat: Support querying all users in cacct for admins * Now the `--user` supports a special value `all` to get stats of all users. Signed-off-by: Mahendra Paipuri --- Makefile | 2 ++ cmd/cacct/api.go | 9 +++-- cmd/cacct/main.go | 5 +-- .../e2e-test-cacct-admin-user-all-users.txt | 27 ++++++++++++++ .../output/e2e-test-cacct-admin-user.txt | 24 ++++++------- .../output/e2e-test-cacct-default-format.txt | 24 ++++++------- .../testdata/output/e2e-test-cacct-tsdata.txt | 36 +++++++++---------- scripts/e2e-test.sh | 7 ++++ website/docs/cli/cacct.md | 2 +- website/docs/configuration/cacct.md | 2 +- website/docs/usage/cacct.md | 4 +++ 11 files changed, 94 insertions(+), 48 deletions(-) create mode 100644 cmd/cacct/testdata/output/e2e-test-cacct-admin-user-all-users.txt diff --git a/Makefile b/Makefile index b2cb2252..990ccdf8 100644 --- a/Makefile +++ b/Makefile @@ -196,6 +196,7 @@ test-e2e: $(PROMTOOL) build pkg/collector/testdata/sys/.unpacked pkg/collector/t ./scripts/e2e-test.sh -s cacct-long-format ./scripts/e2e-test.sh -s cacct-custom-format ./scripts/e2e-test.sh -s cacct-admin-user + ./scripts/e2e-test.sh -s cacct-admin-user-all-users ./scripts/e2e-test.sh -s cacct-forbid-query ./scripts/e2e-test.sh -s cacct-invalid-config ./scripts/e2e-test.sh -s cacct-tsdata @@ -292,6 +293,7 @@ test-e2e-update: build pkg/collector/testdata/sys/.unpacked pkg/collector/testda ./scripts/e2e-test.sh -s cacct-long-format -u || true ./scripts/e2e-test.sh -s cacct-custom-format -u || true ./scripts/e2e-test.sh -s cacct-admin-user -u || true + ./scripts/e2e-test.sh -s cacct-admin-user-all-users -u || true ./scripts/e2e-test.sh -s cacct-forbid-query -u || true ./scripts/e2e-test.sh -s cacct-invalid-config -u || true ./scripts/e2e-test.sh -s cacct-tsdata -u || true diff --git a/cmd/cacct/api.go b/cmd/cacct/api.go index ab32938a..cc0ce259 100644 --- a/cmd/cacct/api.go +++ b/cmd/cacct/api.go @@ -96,8 +96,13 @@ func stats( var unitsReqURL, usageReqURL string if len(userNames) > 0 { - for _, user := range userNames { - urlValues.Add("user", user) + // If --user flag does not contain special value "all", add them to the query. + // If "all" is provided in the --user flag, dont add any query parameters so + // that API server returns jobs of all users. + if !slices.Contains(userNames, "all") { + for _, user := range userNames { + urlValues.Add("user", user) + } } unitsReqURL = apiURL.JoinPath("/api/v1/units/admin").String() diff --git a/cmd/cacct/main.go b/cmd/cacct/main.go index a247c01e..7c174db8 100644 --- a/cmd/cacct/main.go +++ b/cmd/cacct/main.go @@ -209,6 +209,7 @@ var ( defaultFields = []string{ "jobid", + "user", "account", "elapsed", "cpuusage", @@ -441,7 +442,7 @@ func main() { "job", "Comma separated list of jobs to display information. Default is all jobs in the period.", ).StringVar(&jobsFlag) cacctApp.Flag( - "user", "Comma separated list of user names to select jobs to display. By default, the running user is used.", + "user", "Comma separated list of user names to select jobs to display. A special value `all` can be used to fetch jobs of all users when querying user has enough privileges. By default, the running user is used.", ).StringVar(&usersFlag) cacctApp.Flag( "format", "Comma separated list of fields (Use --helpformat for list of available fields).", @@ -740,7 +741,7 @@ func newTable(currentUser string, users []string, units []models.Unit, usages [] t.AppendSeparator() for _, usage := range usages { - if usage.User == currentUser || slices.Contains(users, usage.User) { + if usage.User == currentUser || slices.Contains(users, usage.User) || slices.Contains(users, "all") { // Check if elapsed time in non zero var totalElapsedTime string if usage.TotalTime["walltime"] > 0 { diff --git a/cmd/cacct/testdata/output/e2e-test-cacct-admin-user-all-users.txt b/cmd/cacct/testdata/output/e2e-test-cacct-admin-user-all-users.txt new file mode 100644 index 00000000..447d42df --- /dev/null +++ b/cmd/cacct/testdata/output/e2e-test-cacct-admin-user-all-users.txt @@ -0,0 +1,27 @@ +┌─────────┬─────────┬───────┬──────────┬────────┬────────┬──────────┬─────────────────────────┬────────┬────────┬──────────┬─────────────────────────┐ +│ JOB ID │ ACCOUNT │ USER │ ELAPSED │ CPU US │ CPU ME │ HOST ENE │ HOST EMISSIO │ GPU US │ GPU ME │ GPU ENER │ GPU EMISSION │ +│ │ │ │ │ AGE(%) │ M. USA │ RGY(KWH) │ NS(GMS) │ AGE(%) │ M. USA │ GY(KWH) │ S(GMS) │ +│ │ │ │ │ │ GE(%) │ │ │ │ GE(%) │ │ │ +│ │ │ │ │ │ │ │ EMAPS_TOTAL │ RTE_TOTAL │ │ │ │ EMAPS_TOTAL │ RTE_TOTAL │ +├─────────┼─────────┼───────┼──────────┼────────┼────────┼──────────┼─────────────┼───────────┼────────┼────────┼──────────┼─────────────┼───────────┤ +│ 1009248 │ testacc │ testu │ 00:00:17 │ 21.23 │ 21.23 │ 21.23464 │ 21.234647 │ 21.234647 │ 21.23 │ 21.23 │ 21.23464 │ 21.234647 │ 21.234647 │ +│ │ │ sr │ │ │ │ 7 │ │ │ │ │ 7 │ │ │ +│ 11508 │ acc1 │ usr15 │ 00:08:17 │ 17.80 │ 17.80 │ 17.79969 │ 17.799693 │ 17.799693 │ 17.80 │ 17.80 │ 17.79969 │ 17.799693 │ 17.799693 │ +│ │ │ │ │ │ │ 3 │ │ │ │ │ 3 │ │ │ +│ 14508 │ acc4 │ usr4 │ 00:08:17 │ 14.03 │ 14.03 │ 14.03205 │ 14.032058 │ 14.032058 │ 14.03 │ 14.03 │ 14.03205 │ 14.032058 │ 14.032058 │ +│ │ │ │ │ │ │ 8 │ │ │ │ │ 8 │ │ │ +│ 147975 │ acc3 │ usr3 │ 00:49:22 │ 29.72 │ 29.72 │ 29.72084 │ 29.720843 │ 29.720843 │ 29.72 │ 29.72 │ 29.72084 │ 29.720843 │ 29.720843 │ +│ │ │ │ │ │ │ 3 │ │ │ │ │ 3 │ │ │ +│ 1479763 │ acc1 │ usr1 │ 00:49:22 │ 21.22 │ 21.22 │ 21.22149 │ 21.221494 │ 21.221494 │ 21.22 │ 21.22 │ 21.22149 │ 21.221494 │ 21.221494 │ +│ │ │ │ │ │ │ 4 │ │ │ │ │ 4 │ │ │ +│ 1479765 │ acc1 │ usr8 │ 00:49:22 │ 20.21 │ 20.21 │ 20.21483 │ 20.214837 │ 20.214837 │ 20.21 │ 20.21 │ 20.21483 │ 20.214837 │ 20.214837 │ +│ │ │ │ │ │ │ 7 │ │ │ │ │ 7 │ │ │ +│ 1481508 │ acc2 │ usr2 │ 00:08:17 │ 53.48 │ 53.48 │ 53.47701 │ 53.477015 │ 53.477015 │ 53.48 │ 53.48 │ 53.47701 │ 53.477015 │ 53.477015 │ +│ │ │ │ │ │ │ 5 │ │ │ │ │ 5 │ │ │ +│ 1481510 │ acc3 │ usr3 │ 00:00:17 │ 50.14 │ 50.14 │ 50.13620 │ 50.136201 │ 50.136201 │ 50.14 │ 50.14 │ 50.13620 │ 50.136201 │ 50.136201 │ +│ │ │ │ │ │ │ 1 │ │ │ │ │ 1 │ │ │ +│ 81510 │ acc1 │ usr15 │ 00:00:17 │ 18.57 │ 18.57 │ 18.57046 │ 18.570466 │ 18.570466 │ 18.57 │ 18.57 │ 18.57046 │ 18.570466 │ 18.570466 │ +│ │ │ │ │ │ │ 6 │ │ │ │ │ 6 │ │ │ +├─────────┼─────────┴───────┴──────────┴────────┴────────┴──────────┴─────────────┴───────────┴────────┴────────┴──────────┴─────────────┴───────────┤ +│ Summary │ │ +└─────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ diff --git a/cmd/cacct/testdata/output/e2e-test-cacct-admin-user.txt b/cmd/cacct/testdata/output/e2e-test-cacct-admin-user.txt index 08afd9d5..7a4ba87f 100644 --- a/cmd/cacct/testdata/output/e2e-test-cacct-admin-user.txt +++ b/cmd/cacct/testdata/output/e2e-test-cacct-admin-user.txt @@ -1,12 +1,12 @@ -┌─────────┬─────────┬──────────┬────────┬────────┬──────────┬─────────────────────────┬────────┬────────┬──────────┬─────────────────────────┐ -│ JOB ID │ ACCOUNT │ ELAPSED │ CPU US │ CPU ME │ HOST ENE │ HOST EMISSIO │ GPU US │ GPU ME │ GPU ENER │ GPU EMISSION │ -│ │ │ │ AGE(%) │ M. USA │ RGY(KWH) │ NS(GMS) │ AGE(%) │ M. USA │ GY(KWH) │ S(GMS) │ -│ │ │ │ │ GE(%) │ │ │ │ GE(%) │ │ │ -├─────────┼─────────┼──────────┼────────┼────────┼──────────┼─────────────┬───────────┼────────┼────────┼──────────┼─────────────┬───────────┤ -│ │ │ │ │ │ │ EMAPS_TOTAL │ RTE_TOTAL │ │ │ │ EMAPS_TOTAL │ RTE_TOTAL │ -├─────────┼─────────┼──────────┼────────┼────────┼──────────┼─────────────┼───────────┼────────┼────────┼──────────┼─────────────┼───────────┤ -│ 1479763 │ acc1 │ 00:49:22 │ 21.22 │ 21.22 │ 21.22149 │ 21.221494 │ 21.221494 │ 21.22 │ 21.22 │ 21.22149 │ 21.221494 │ 21.221494 │ -│ │ │ │ │ │ 4 │ │ │ │ │ 4 │ │ │ -├─────────┼─────────┴──────────┴────────┴────────┴──────────┴─────────────┴───────────┴────────┴────────┴──────────┴─────────────┴───────────┤ -│ Summary │ │ -└─────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +┌─────────┬─────────┬───────┬──────────┬────────┬────────┬──────────┬─────────────────────────┬────────┬────────┬──────────┬─────────────────────────┐ +│ JOB ID │ ACCOUNT │ USER │ ELAPSED │ CPU US │ CPU ME │ HOST ENE │ HOST EMISSIO │ GPU US │ GPU ME │ GPU ENER │ GPU EMISSION │ +│ │ │ │ │ AGE(%) │ M. USA │ RGY(KWH) │ NS(GMS) │ AGE(%) │ M. USA │ GY(KWH) │ S(GMS) │ +│ │ │ │ │ │ GE(%) │ │ │ │ GE(%) │ │ │ +├─────────┼─────────┼───────┼──────────┼────────┼────────┼──────────┼─────────────┬───────────┼────────┼────────┼──────────┼─────────────┬───────────┤ +│ │ │ │ │ │ │ │ EMAPS_TOTAL │ RTE_TOTAL │ │ │ │ EMAPS_TOTAL │ RTE_TOTAL │ +├─────────┼─────────┼───────┼──────────┼────────┼────────┼──────────┼─────────────┼───────────┼────────┼────────┼──────────┼─────────────┼───────────┤ +│ 1479763 │ acc1 │ usr1 │ 00:49:22 │ 21.22 │ 21.22 │ 21.22149 │ 21.221494 │ 21.221494 │ 21.22 │ 21.22 │ 21.22149 │ 21.221494 │ 21.221494 │ +│ │ │ │ │ │ │ 4 │ │ │ │ │ 4 │ │ │ +├─────────┼─────────┴───────┴──────────┴────────┴────────┴──────────┴─────────────┴───────────┴────────┴────────┴──────────┴─────────────┴───────────┤ +│ Summary │ │ +└─────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ diff --git a/cmd/cacct/testdata/output/e2e-test-cacct-default-format.txt b/cmd/cacct/testdata/output/e2e-test-cacct-default-format.txt index 08afd9d5..7a4ba87f 100644 --- a/cmd/cacct/testdata/output/e2e-test-cacct-default-format.txt +++ b/cmd/cacct/testdata/output/e2e-test-cacct-default-format.txt @@ -1,12 +1,12 @@ -┌─────────┬─────────┬──────────┬────────┬────────┬──────────┬─────────────────────────┬────────┬────────┬──────────┬─────────────────────────┐ -│ JOB ID │ ACCOUNT │ ELAPSED │ CPU US │ CPU ME │ HOST ENE │ HOST EMISSIO │ GPU US │ GPU ME │ GPU ENER │ GPU EMISSION │ -│ │ │ │ AGE(%) │ M. USA │ RGY(KWH) │ NS(GMS) │ AGE(%) │ M. USA │ GY(KWH) │ S(GMS) │ -│ │ │ │ │ GE(%) │ │ │ │ GE(%) │ │ │ -├─────────┼─────────┼──────────┼────────┼────────┼──────────┼─────────────┬───────────┼────────┼────────┼──────────┼─────────────┬───────────┤ -│ │ │ │ │ │ │ EMAPS_TOTAL │ RTE_TOTAL │ │ │ │ EMAPS_TOTAL │ RTE_TOTAL │ -├─────────┼─────────┼──────────┼────────┼────────┼──────────┼─────────────┼───────────┼────────┼────────┼──────────┼─────────────┼───────────┤ -│ 1479763 │ acc1 │ 00:49:22 │ 21.22 │ 21.22 │ 21.22149 │ 21.221494 │ 21.221494 │ 21.22 │ 21.22 │ 21.22149 │ 21.221494 │ 21.221494 │ -│ │ │ │ │ │ 4 │ │ │ │ │ 4 │ │ │ -├─────────┼─────────┴──────────┴────────┴────────┴──────────┴─────────────┴───────────┴────────┴────────┴──────────┴─────────────┴───────────┤ -│ Summary │ │ -└─────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ +┌─────────┬─────────┬───────┬──────────┬────────┬────────┬──────────┬─────────────────────────┬────────┬────────┬──────────┬─────────────────────────┐ +│ JOB ID │ ACCOUNT │ USER │ ELAPSED │ CPU US │ CPU ME │ HOST ENE │ HOST EMISSIO │ GPU US │ GPU ME │ GPU ENER │ GPU EMISSION │ +│ │ │ │ │ AGE(%) │ M. USA │ RGY(KWH) │ NS(GMS) │ AGE(%) │ M. USA │ GY(KWH) │ S(GMS) │ +│ │ │ │ │ │ GE(%) │ │ │ │ GE(%) │ │ │ +├─────────┼─────────┼───────┼──────────┼────────┼────────┼──────────┼─────────────┬───────────┼────────┼────────┼──────────┼─────────────┬───────────┤ +│ │ │ │ │ │ │ │ EMAPS_TOTAL │ RTE_TOTAL │ │ │ │ EMAPS_TOTAL │ RTE_TOTAL │ +├─────────┼─────────┼───────┼──────────┼────────┼────────┼──────────┼─────────────┼───────────┼────────┼────────┼──────────┼─────────────┼───────────┤ +│ 1479763 │ acc1 │ usr1 │ 00:49:22 │ 21.22 │ 21.22 │ 21.22149 │ 21.221494 │ 21.221494 │ 21.22 │ 21.22 │ 21.22149 │ 21.221494 │ 21.221494 │ +│ │ │ │ │ │ │ 4 │ │ │ │ │ 4 │ │ │ +├─────────┼─────────┴───────┴──────────┴────────┴────────┴──────────┴─────────────┴───────────┴────────┴────────┴──────────┴─────────────┴───────────┤ +│ Summary │ │ +└─────────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘ diff --git a/cmd/cacct/testdata/output/e2e-test-cacct-tsdata.txt b/cmd/cacct/testdata/output/e2e-test-cacct-tsdata.txt index 132bc8ab..b99b4f3d 100644 --- a/cmd/cacct/testdata/output/e2e-test-cacct-tsdata.txt +++ b/cmd/cacct/testdata/output/e2e-test-cacct-tsdata.txt @@ -1,21 +1,21 @@ -┌─────────┬─────────┬──────────┬────────┬────────┬──────────┬─────────────────────────┬────────┬────────┬──────────┬─────────────────────────┐ -│ JOB ID │ ACCOUNT │ ELAPSED │ CPU US │ CPU ME │ HOST ENE │ HOST EMISSIO │ GPU US │ GPU ME │ GPU ENER │ GPU EMISSION │ -│ │ │ │ AGE(%) │ M. USA │ RGY(KWH) │ NS(GMS) │ AGE(%) │ M. USA │ GY(KWH) │ S(GMS) │ -│ │ │ │ │ GE(%) │ │ │ │ GE(%) │ │ │ -├─────────┼─────────┼──────────┼────────┼────────┼──────────┼─────────────┬───────────┼────────┼────────┼──────────┼─────────────┬───────────┤ -│ │ │ │ │ │ │ EMAPS_TOTAL │ RTE_TOTAL │ │ │ │ EMAPS_TOTAL │ RTE_TOTAL │ -├─────────┼─────────┼──────────┼────────┼────────┼──────────┼─────────────┼───────────┼────────┼────────┼──────────┼─────────────┼───────────┤ -│ 147973 │ acc2 │ 00:00:17 │ 29.39 │ 29.39 │ 29.38529 │ 29.385290 │ 29.385290 │ 29.39 │ 29.39 │ 29.38529 │ 29.385290 │ 29.385290 │ -│ │ │ │ │ │ 0 │ │ │ │ │ 0 │ │ │ -├─────────┼─────────┴──────────┴────────┴────────┴──────────┴─────────────┴───────────┴────────┴────────┴──────────┴─────────────┴───────────┤ -│ Summary │ │ -├─────────┼─────────┬──────────┬────────┬────────┬──────────┬─────────────┬───────────┬────────┬────────┬──────────┬─────────────┬───────────┤ -│ 1 │ acc1 │ 00:49:22 │ 21.22 │ 21.22 │ 21.22149 │ 21.221494 │ 21.221494 │ 21.22 │ 21.22 │ 21.22149 │ 21.221494 │ 21.221494 │ -│ │ │ │ │ │ 4 │ │ │ │ │ 4 │ │ │ -├─────────┼─────────┼──────────┼────────┼────────┼──────────┼─────────────┼───────────┼────────┼────────┼──────────┼─────────────┼───────────┤ -│ 1 │ acc2 │ 00:08:17 │ 29.39 │ 29.39 │ 29.38529 │ 29.385290 │ 29.385290 │ 29.39 │ 29.39 │ 29.38529 │ 29.385290 │ 29.385290 │ -│ │ │ │ │ │ 0 │ │ │ │ │ 0 │ │ │ -└─────────┴─────────┴──────────┴────────┴────────┴──────────┴─────────────┴───────────┴────────┴────────┴──────────┴─────────────┴───────────┘ +┌─────────┬─────────┬───────┬──────────┬────────┬────────┬──────────┬─────────────────────────┬────────┬────────┬──────────┬─────────────────────────┐ +│ JOB ID │ ACCOUNT │ USER │ ELAPSED │ CPU US │ CPU ME │ HOST ENE │ HOST EMISSIO │ GPU US │ GPU ME │ GPU ENER │ GPU EMISSION │ +│ │ │ │ │ AGE(%) │ M. USA │ RGY(KWH) │ NS(GMS) │ AGE(%) │ M. USA │ GY(KWH) │ S(GMS) │ +│ │ │ │ │ │ GE(%) │ │ │ │ GE(%) │ │ │ +├─────────┼─────────┼───────┼──────────┼────────┼────────┼──────────┼─────────────┬───────────┼────────┼────────┼──────────┼─────────────┬───────────┤ +│ │ │ │ │ │ │ │ EMAPS_TOTAL │ RTE_TOTAL │ │ │ │ EMAPS_TOTAL │ RTE_TOTAL │ +├─────────┼─────────┼───────┼──────────┼────────┼────────┼──────────┼─────────────┼───────────┼────────┼────────┼──────────┼─────────────┼───────────┤ +│ 147973 │ acc2 │ usr1 │ 00:00:17 │ 29.39 │ 29.39 │ 29.38529 │ 29.385290 │ 29.385290 │ 29.39 │ 29.39 │ 29.38529 │ 29.385290 │ 29.385290 │ +│ │ │ │ │ │ │ 0 │ │ │ │ │ 0 │ │ │ +├─────────┼─────────┴───────┴──────────┴────────┴────────┴──────────┴─────────────┴───────────┴────────┴────────┴──────────┴─────────────┴───────────┤ +│ Summary │ │ +├─────────┼─────────┬───────┬──────────┬────────┬────────┬──────────┬─────────────┬───────────┬────────┬────────┬──────────┬─────────────┬───────────┤ +│ 1 │ acc1 │ usr1 │ 00:49:22 │ 21.22 │ 21.22 │ 21.22149 │ 21.221494 │ 21.221494 │ 21.22 │ 21.22 │ 21.22149 │ 21.221494 │ 21.221494 │ +│ │ │ │ │ │ │ 4 │ │ │ │ │ 4 │ │ │ +├─────────┼─────────┼───────┼──────────┼────────┼────────┼──────────┼─────────────┼───────────┼────────┼────────┼──────────┼─────────────┼───────────┤ +│ 1 │ acc2 │ usr1 │ 00:08:17 │ 29.39 │ 29.39 │ 29.38529 │ 29.385290 │ 29.385290 │ 29.39 │ 29.39 │ 29.38529 │ 29.385290 │ 29.385290 │ +│ │ │ │ │ │ │ 0 │ │ │ │ │ 0 │ │ │ +└─────────┴─────────┴───────┴──────────┴────────┴────────┴──────────┴─────────────┴───────────┴────────┴────────┴──────────┴─────────────┴───────────┘ [ { "fingerprint": "554b56cadf9dea4b", diff --git a/scripts/e2e-test.sh b/scripts/e2e-test.sh index ad3154e4..eed09d23 100755 --- a/scripts/e2e-test.sh +++ b/scripts/e2e-test.sh @@ -433,6 +433,10 @@ then then desc="cacct by admin user" fixture='cmd/cacct/testdata/output/e2e-test-cacct-admin-user.txt' + elif [ "${scenario}" = "cacct-admin-user-all-users" ] + then + desc="cacct by admin user for all users" + fixture='cmd/cacct/testdata/output/e2e-test-cacct-admin-user-all-users.txt' elif [ "${scenario}" = "cacct-forbid-query" ] then desc="cacct by normal user attempt to admin query" @@ -1651,6 +1655,9 @@ then elif [ "${scenario}" = "cacct-admin-user" ] then ./bin/cacct --current-user=grafana --config-path="cmd/cacct/testdata" --starttime="2022-02-20" --endtime="2022-03-20" --user=usr1,usr2 > "${fixture_output}" 2>&1 + elif [ "${scenario}" = "cacct-admin-user-all-users" ] + then + ./bin/cacct --current-user=grafana --config-path="cmd/cacct/testdata" --starttime="2022-02-20" --endtime="2023-03-20" --user=all > "${fixture_output}" 2>&1 elif [ "${scenario}" = "cacct-forbid-query" ] then ./bin/cacct --current-user=usr3 --config-path="cmd/cacct/testdata" --starttime="2022-02-20" --endtime="2022-03-20" --user=usr1,usr2 > "${fixture_output}" 2>&1 || true diff --git a/website/docs/cli/cacct.md b/website/docs/cli/cacct.md index 147dd3d8..addbdaf7 100644 --- a/website/docs/cli/cacct.md +++ b/website/docs/cli/cacct.md @@ -14,7 +14,7 @@ sidebar_position: 4 | `--starttime` | Select jobs eligible after this time. Valid format is YYYY-MM-DD[THH\:MM[\:SS]] | Today midnight | | `--endtime` | Select jobs eligible before this time. Valid format is YYYY-MM-DD[THH\:MM[\:SS]] | Current time | | `--job` | Comma separated list of jobs to display information | | -| `--user` | Comma separated list of user names to select jobs to display | | +| `--user` | Comma separated list of user names to select jobs to display.A special value `all` can be used to fetch jobs of all users when querying user has enough privileges. By default, the running user is used. | | | `--format` | Comma separated list of fields | | | `--helpformat` | List of available fields | | | `--ts` | Time series data of jobs are saved in CSV format | `false` | diff --git a/website/docs/configuration/cacct.md b/website/docs/configuration/cacct.md index 1b39176c..7b1e9ae3 100644 --- a/website/docs/configuration/cacct.md +++ b/website/docs/configuration/cacct.md @@ -235,7 +235,7 @@ Now, every time `cacct` is invoked, it will have privileges of the `ceems` user/ Similarly, if system logging is desired, the `cacct` binary should keep the group ownership of `ceems` while end user launches the application. This way the log file will be owned by `ceems` user preventing -regular end users to access it. +regular end users to access it. ```bash # Create a directory to place system level log file diff --git a/website/docs/usage/cacct.md b/website/docs/usage/cacct.md index 52d17bc4..2f618226 100644 --- a/website/docs/usage/cacct.md +++ b/website/docs/usage/cacct.md @@ -61,6 +61,10 @@ of other users, an empty response will be returned. ::: +The CLI argument `--user` takes a special value `all` when provided, it `cacct` will +return the statistics of all users. However, the user who is making the request must be +still declared as admin user in the CEEMS API server. + ## Time Series Data Besides aggregate accounting statistics, `cacct` is capable of fetching time series