Skip to content

Commit

Permalink
BYTES_TO_MEGABYTES w->inuse_cache
Browse files Browse the repository at this point in the history
  • Loading branch information
JinZhou5042 committed Dec 11, 2024
1 parent b6e17e0 commit 7ac0d39
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions taskvine/src/manager/vine_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -2611,7 +2611,7 @@ struct rmsummary *vine_manager_choose_resources_for_task(struct vine_manager *q,
const struct rmsummary *max = vine_manager_task_resources_max(q, t);

/* available disk for all sandboxes */
int64_t available_disk = w->resources->disk.total - w->resources->disk.inuse;
int64_t available_disk = w->resources->disk.total - BYTES_TO_MEGABYTES(w->inuse_cache);

/* do not count the size of input files as available.
* TODO: efficiently discount the size of files already at worker. */
Expand Down Expand Up @@ -2834,8 +2834,9 @@ static void count_worker_resources(struct vine_manager *q, struct vine_worker_in

static void update_max_worker(struct vine_manager *q, struct vine_worker_info *w)
{
if (!w)
if (!w) {
return;
}

if (w->resources->workers.total < 1) {
return;
Expand All @@ -2849,8 +2850,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

0 comments on commit 7ac0d39

Please sign in to comment.