Skip to content

Commit 52e9d0d

Browse files
committed
resource: round drain timestamps to nearest whole seconds
Problem: Timestamps for drained nodes are kept with sub-microsecond precision. This causes the drain object in the resource.status response to be much less compressible with arguably little benefit. It also reduces the number of lines that can be coalesced in `flux resource drain`. Round timestamps while building the drainset object. This reduces the drain object size when a significant number of ranks are drained within the same second.
1 parent 42fdaaa commit 52e9d0d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/modules/resource/drain.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "config.h"
3838
#endif
3939
#include <time.h>
40+
#include <math.h>
4041
#include <flux/core.h>
4142
#include <jansson.h>
4243

@@ -281,7 +282,7 @@ json_t *drain_get_info (struct drain *drain)
281282
if (drain->info[rank].drained) {
282283
if (drainset_drain_rank (ds,
283284
rank,
284-
drain->info[rank].timestamp,
285+
round(drain->info[rank].timestamp),
285286
drain->info[rank].reason) < 0)
286287
goto error;
287288
}

0 commit comments

Comments
 (0)