Skip to content

Commit

Permalink
[GH-99] Add volume size for default scratch option
Browse files Browse the repository at this point in the history
When user does not specify scratch = true specifically, we failed to add the volume option.
We should also check if work directory is network based and scratch is not specified.
  • Loading branch information
jealous committed Sep 25, 2024
1 parent 9aae308 commit 0591c8b
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -446,18 +446,24 @@ fi
return cmd
}

private boolean shouldCheckImage(TaskRun task) {
final scratch = task.scratch
return useNetworkWorkdir() && scratch == null ||
scratch == true ||
isFusionEnabled()
}

void addVolSize(List<String> cmd, TaskRun task) {
long size = FloatConf.MIN_VOL_SIZE

def disk = task.config.getDisk()
if (disk) {
size = Math.max(size, disk.toGiga())
}
final fusionEnabled = isFusionEnabled()
if (fusionEnabled) {
if (isFusionEnabled()) {
size = Math.max(size, FUSION_MIN_VOL_SIZE)
}
if (task.scratch || fusionEnabled) {
if (shouldCheckImage(task)) {
double inputSizeGB = (double) (getInputFileSize(task)) / 1024 / 1024 / 1024
long minDiskSizeBasedOnInput = Math.round(inputSizeGB * DISK_INPUT_FACTOR)
size = Math.max(size, minDiskSizeBasedOnInput)
Expand Down

0 comments on commit 0591c8b

Please sign in to comment.