Source code for neuroconv.tools.data_transfers._aws

"""Collection of helper functions for assessing and performing automated data transfers related to AWS."""


[docs]def estimate_s3_conversion_cost( total_mb: float, transfer_rate_mb: float = 20.0, conversion_rate_mb: float = 17.0, upload_rate_mb: float = 40.0, compression_ratio: float = 1.7, ): """ Estimate potential cost of performing an entire conversion on S3 using full automation. Parameters ---------- total_mb: float The total amount of data (in MB) that will be transferred, converted, and uploaded to dandi. transfer_rate_mb : float, default: 20.0 Estimate of the transfer rate for the data. conversion_rate_mb : float, default: 17.0 Estimate of the conversion rate for the data. Can vary widely depending on conversion options and type of data. Figure of 17MB/s is based on extensive compression of high-volume, high-resolution ecephys. upload_rate_mb : float, default: 40.0 Estimate of the upload rate of a single file to the DANDI Archive. compression_ratio : float, default: 1.7 Estimate of the final average compression ratio for datasets in the file. Can vary widely. """ c = 1 / compression_ratio # compressed_size = total_size * c total_mb_s = total_mb**2 / 2 * (1 / transfer_rate_mb + (2 * c + 1) / conversion_rate_mb + 2 * c**2 / upload_rate_mb) cost_gb_m = 0.08 / 1e3 # $0.08 / GB Month cost_mb_s = cost_gb_m / (1e3 * 2.628e6) # assuming 30 day month; unsure how amazon weights shorter months? return cost_mb_s * total_mb_s