def bigfile_1_1gb(request, asset_path): filesize_in_gigabyte = 1.1 required_in_gigabyte = filesize_in_gigabyte * 2 + FREESTORAGE_BUFFER_IN_GIGABYTES check_required_freestoreage(required_in_gigabyte, asset_path) file_relpath = "single_bigfile_{}gb".format(filesize_in_gigabyte) filepath = os.path.join(asset_path, file_relpath) fileio_utils.generate_file(filepath, filesize_in_gigabyte * 1024) finalizer = fileio_utils.get_filedeletion_finalizer_with_path(filepath) request.addfinalizer(finalizer) atexit.register(finalizer) return AssetFile(filepath, file_relpath)
def upload_bigfile_60gb(request, temp_path, asset_path): filesize_in_gigabyte = 60 required_in_gigabyte = filesize_in_gigabyte * 2 + FREESTORAGE_BUFFER_IN_GIGABYTES check_required_freestoreage(required_in_gigabyte, asset_path) upload_filepath = temp_path.join( "upload_bigfile_{}gb".format(filesize_in_gigabyte)) fileio_utils.generate_file(upload_filepath, filesize_in_gigabyte * 1024) def finalizer(): if upload_filepath.exists(): upload_filepath.remove() request.addfinalizer(finalizer) atexit.register(finalizer) return upload_filepath