This is an automated email from the ASF dual-hosted git repository. tomaz pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/libcloud.git
commit 7bffd095b151d451bf6f723e89a88745c52399a8 Author: Tomaz Muraus <to...@tomaz.me> AuthorDate: Thu Sep 8 12:51:42 2022 +0200 Also display progress bar when parsing sku pricing data. --- contrib/scrape-ec2-prices.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contrib/scrape-ec2-prices.py b/contrib/scrape-ec2-prices.py index de6b6278f..cb482c034 100755 --- a/contrib/scrape-ec2-prices.py +++ b/contrib/scrape-ec2-prices.py @@ -143,10 +143,11 @@ def scrape_ec2_pricing(): json_file, from_file = get_json() with open(json_file, "r") as f: print("Starting to parse pricing data, this could take up to 15 minutes...") + # use parser because file is very large parser = ijson.parse(f, buf_size=IJSON_BUF_SIZE) current_sku = "" - for prefix, event, value in parser: + for prefix, event, value in tqdm.tqdm(parser): if "terms" in prefix: break if (prefix, event) == ("products", "map_key"): @@ -196,6 +197,7 @@ def scrape_ec2_pricing(): and "Dedicated Host" not in skus[current_sku]["family"] ): del skus[current_sku] + ec2_linux = defaultdict(OrderedDict) ec2_windows = defaultdict(OrderedDict) ec2_rhel = defaultdict(OrderedDict)