Skip to content

Commit 9acc723

Browse files
committed
Reporting fixes for culling unpacked tar balls
1 parent 172a128 commit 9acc723

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

server/bin/gold/test-27.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ len(actions) = 1
2020
"chunk_id": 1,
2121
"doctype": "status",
2222
"name": "pbench-cull-unpacked-tarballs",
23-
"text": "Culled 3 unpacked tar ball directories (0 errors) in 0.00 secs\n\nActions Taken:\n - controller-no-prefixes/tarball_culled_1970.01.01T00.00.00 (0 errors, {act_set.duration():0.2f} secs)\n $ rm results/controller-no-prefixes/tarball_culled_1970.01.01T00.00.00 # succ\n $ mv incoming/controller-no-prefixes/tarball_culled_1970.01.01T00.00.00 incoming/controller-no-prefixes/.delete.tarball_culled_1970.01.01T00.00.00 # succ\n $ rmtree incoming/controller-no-prefixes/.delete.tarball_culled_1970.01.01T00.00.00 # succ\n - controller-prefixes/tarball_culled-w-prefix_1970.01.01T00.00.00 (0 errors, {act_set.duration():0.2f} secs)\n $ rm results/controller-prefixes/pre0/pre1/pre2/tarball_culled-w-prefix_1970.01.01T00.00.00 # succ\n $ mv incoming/controller-prefixes/tarball_culled-w-prefix_1970.01.01T00.00.00 incoming/controller-prefixes/.delete.tarball_culled-w-prefix_1970.01.01T00.00.00 # succ\n $ rmtree incoming/controller-prefixes/.delete.tarball_culled-w-prefix_1970.01.01T00.00.00 # succ\n - controller-prefixes/tarball_culled-w-userA_1970.01.01T00.00.00 (0 errors, {act_set.duration():0.2f} secs)\n $ rm results/controller-prefixes/path0/path1/tarball_culled-w-userA_1970.01.01T00.00.00 # succ\n $ rm users/userA/controller-prefixes/path0/path1/tarball_culled-w-userA_1970.01.01T00.00.00 # succ\n $ mv incoming/controller-prefixes/tarball_culled-w-userA_1970.01.01T00.00.00 incoming/controller-prefixes/.delete.tarball_culled-w-userA_1970.01.01T00.00.00 # succ\n $ rmtree incoming/controller-prefixes/.delete.tarball_culled-w-userA_1970.01.01T00.00.00 # succ\n",
23+
"text": "Culled 3 unpacked tar ball directories (0 errors) in 0.00 secs\n\nActions Taken:\n - controller-no-prefixes/tarball_culled_1970.01.01T00.00.00 (0 errors, 0.00 secs)\n $ rm results/controller-no-prefixes/tarball_culled_1970.01.01T00.00.00 # succ\n $ mv incoming/controller-no-prefixes/tarball_culled_1970.01.01T00.00.00 incoming/controller-no-prefixes/.delete.tarball_culled_1970.01.01T00.00.00 # succ\n $ rmtree incoming/controller-no-prefixes/.delete.tarball_culled_1970.01.01T00.00.00 # succ\n - controller-prefixes/tarball_culled-w-prefix_1970.01.01T00.00.00 (0 errors, 0.00 secs)\n $ rm results/controller-prefixes/pre0/pre1/pre2/tarball_culled-w-prefix_1970.01.01T00.00.00 # succ\n $ mv incoming/controller-prefixes/tarball_culled-w-prefix_1970.01.01T00.00.00 incoming/controller-prefixes/.delete.tarball_culled-w-prefix_1970.01.01T00.00.00 # succ\n $ rmtree incoming/controller-prefixes/.delete.tarball_culled-w-prefix_1970.01.01T00.00.00 # succ\n - controller-prefixes/tarball_culled-w-userA_1970.01.01T00.00.00 (0 errors, 0.00 secs)\n $ rm results/controller-prefixes/path0/path1/tarball_culled-w-userA_1970.01.01T00.00.00 # succ\n $ rm users/userA/controller-prefixes/path0/path1/tarball_culled-w-userA_1970.01.01T00.00.00 # succ\n $ mv incoming/controller-prefixes/tarball_culled-w-userA_1970.01.01T00.00.00 incoming/controller-prefixes/.delete.tarball_culled-w-userA_1970.01.01T00.00.00 # succ\n $ rmtree incoming/controller-prefixes/.delete.tarball_culled-w-userA_1970.01.01T00.00.00 # succ\n",
2424
"total_chunks": 1,
25-
"total_size": 1614
25+
"total_size": 1551
2626
},
2727
"_type": "pbench-server-reports"
2828
}

server/bin/pbench-cull-unpacked-tarballs.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ def __init__(self, actions, errors, start, end):
7979
def set_name(self, name):
8080
self.name = name
8181

82+
def duration(self):
83+
return self.end - self.start
84+
8285

8386
def fetch_username(tb_incoming_dir):
8487
"""fetch_username - Return the pbench "run"'s "user" value from the
@@ -239,7 +242,7 @@ def remove_unpacked(tb_incoming_dir, controller_name, results, users, logger, dr
239242
end = pbench._time()
240243
act_set = ActionSet(actions_taken, errors, start, end)
241244
if errors == 0:
242-
duration = 0.0 if start < end else start - end
245+
duration = 0.0 if end < start else end - start
243246
logger.info(
244247
"After {:0.2f} seconds, finished removal of unpacked tar ball"
245248
" directory, '{}'",
@@ -457,7 +460,7 @@ def main(options):
457460
for act_set in actions_taken:
458461
print(
459462
f" - {act_set.name} ({act_set.errors:d} errors,"
460-
" {act_set.duration():0.2f} secs)",
463+
f" {act_set.duration():0.2f} secs)",
461464
file=tfp,
462465
)
463466
for act in act_set.actions:

0 commit comments

Comments
 (0)