mirror of
https://github.com/mongodb/mongo.git
synced 2024-11-24 00:17:37 +01:00
b4b23946cd
GitOrigin-RevId: 9d997a9f44cd43a8dec7c2a17fa2dbcd875e92f6
31 lines
935 B
Python
31 lines
935 B
Python
#!/usr/bin/env python3
|
|
|
|
import os
|
|
import sys
|
|
|
|
FILE_SIZE_THRESHOLD_IN_BYTES = 16 * 1024 * 1024 # 16MB
|
|
|
|
|
|
def main():
|
|
args = sys.argv[1:]
|
|
file_name = args[0]
|
|
file_path = os.path.join(os.path.dirname(os.getcwd()), file_name)
|
|
if os.path.exists(file_path):
|
|
file_size_in_bytes = os.path.getsize(file_path)
|
|
if file_size_in_bytes > FILE_SIZE_THRESHOLD_IN_BYTES:
|
|
print(
|
|
f"WARNING! {file_name} is {file_size_in_bytes} bytes, exceeding threshold"
|
|
f" {FILE_SIZE_THRESHOLD_IN_BYTES} bytes, file upload may fail due to network issues, or Evergreen"
|
|
f" may reject very large yaml sizes"
|
|
)
|
|
else:
|
|
print(
|
|
f"{file_name} is {file_size_in_bytes} bytes, below threshold {FILE_SIZE_THRESHOLD_IN_BYTES} bytes"
|
|
)
|
|
else:
|
|
print(f"{file_path} does not exist")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|