def calculateDiskSize(tokenFile=None, fileUuid=None, inputFiles=None, inputFileSize=None, scalingFactor=None, roundToNearestGbInterval=None):
if inputFiles is not None:
fileSize = 0
for f in inputFiles:
fileSize += int(subprocess.check_output(["gsutil", "du", f]).split(' ')[0])
elif fileUuid is not None:
fileSize = GDCDataUtils.getFilesize(fileUuid, tokenFile)
elif inputFileSize is not None:
filesize = inputFileSize
else:
raise DataUtilsError("Couldn't determine disk size! Please provide a path to an existing file in GCS or a file uuid from the GDC.")
if scalingFactor is not None:
scalingFactor = int(scalingFactor)
else:
scalingFactor = 1
if roundToNearestGbInterval is not None:
roundTo = float(roundToNearestGbInterval) * 1000000000
else:
roundTo = 1
return int(math.ceil(scalingFactor * fileSize / roundTo) * roundTo) / 1000000000
评论列表
文章目录