Skip to content

Commit

Permalink
resource: round drain timestamps to nearest whole seconds
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
grondo committed Apr 7, 2024
1 parent 0766987 commit 3cbbded
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/modules/resource/drain.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "config.h"
#endif
#include <time.h>
#include <math.h>
#include <flux/core.h>
#include <jansson.h>

Expand Down Expand Up @@ -281,7 +282,7 @@ json_t *drain_get_info (struct drain *drain)
if (drain->info[rank].drained) {
if (drainset_drain_rank (ds,
rank,
drain->info[rank].timestamp,
round(drain->info[rank].timestamp),
drain->info[rank].reason) < 0)
goto error;
}
Expand Down

0 comments on commit 3cbbded

Please sign in to comment.