Skip to content

vine: apply BYTES_TO_MEGABYTES when calculate inuse_cache #4029

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 24, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions taskvine/src/manager/vine_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ static int handle_cache_update(struct vine_manager *q, struct vine_worker_info *

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

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

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

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

if (q->current_max_worker->disk < (w->resources->disk.total - w->inuse_cache)) {
q->current_max_worker->disk = w->resources->disk.total - w->inuse_cache;
if (q->current_max_worker->disk < (w->resources->disk.total - BYTES_TO_MEGABYTES(w->inuse_cache))) {
q->current_max_worker->disk = w->resources->disk.total - BYTES_TO_MEGABYTES(w->inuse_cache);
}

if (q->current_max_worker->gpus < w->resources->gpus.total) {
Expand Down Expand Up @@ -5869,7 +5869,7 @@ static void aggregate_workers_resources(
}

// vine_stats wants MB
*inuse_cache = (int64_t)ceil(*inuse_cache / (1.0 * MEGA));
*inuse_cache = (int64_t)ceil(BYTES_TO_MEGABYTES(*inuse_cache));
}

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