Skip to content

Commit 4f68974

Browse files
authored
vine: apply BYTES_TO_MEGABYTES to inuse_cache (#4029)
1 parent 738c2a3 commit 4f68974

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

taskvine/src/manager/vine_manager.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@ static int handle_cache_update(struct vine_manager *q, struct vine_worker_info *
371371

372372
vine_txn_log_write_cache_update(q, w, size, transfer_time, start_time, cachename);
373373

374-
w->resources->disk.inuse += size / 1e6;
374+
w->resources->disk.inuse += BYTES_TO_MEGABYTES(size);
375375

376376
/* If the replica corresponds to a declared file. */
377377

@@ -2874,8 +2874,8 @@ static void update_max_worker(struct vine_manager *q, struct vine_worker_info *w
28742874
q->current_max_worker->memory = w->resources->memory.total;
28752875
}
28762876

2877-
if (q->current_max_worker->disk < (w->resources->disk.total - w->inuse_cache)) {
2878-
q->current_max_worker->disk = w->resources->disk.total - w->inuse_cache;
2877+
if (q->current_max_worker->disk < (w->resources->disk.total - BYTES_TO_MEGABYTES(w->inuse_cache))) {
2878+
q->current_max_worker->disk = w->resources->disk.total - BYTES_TO_MEGABYTES(w->inuse_cache);
28792879
}
28802880

28812881
if (q->current_max_worker->gpus < w->resources->gpus.total) {
@@ -5869,7 +5869,7 @@ static void aggregate_workers_resources(
58695869
}
58705870

58715871
// vine_stats wants MB
5872-
*inuse_cache = (int64_t)ceil(*inuse_cache / (1.0 * MEGA));
5872+
*inuse_cache = (int64_t)ceil(BYTES_TO_MEGABYTES(*inuse_cache));
58735873
}
58745874

58755875
/* This simple wrapper function allows us to hide the debug.h interface from the end user. */

0 commit comments

Comments
 (0)