diff options
author | deshevoy <deshevoy@yandex-team.ru> | 2022-02-10 16:46:56 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:56 +0300 |
commit | e988f30484abe5fdeedcc7a5d3c226c01a21800c (patch) | |
tree | 0a217b173aabb57b7e51f8a169989b1a3e0309fe /build/scripts/fetch_from_mds.py | |
parent | 33ee501c05d3f24036ae89766a858930ae66c548 (diff) | |
download | ydb-e988f30484abe5fdeedcc7a5d3c226c01a21800c.tar.gz |
Restoring authorship annotation for <deshevoy@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'build/scripts/fetch_from_mds.py')
-rw-r--r-- | build/scripts/fetch_from_mds.py | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/build/scripts/fetch_from_mds.py b/build/scripts/fetch_from_mds.py index 5e4e656394..a498662523 100644 --- a/build/scripts/fetch_from_mds.py +++ b/build/scripts/fetch_from_mds.py @@ -1,50 +1,50 @@ -import os -import sys -import logging +import os +import sys +import logging import argparse - -import fetch_from - -MDS_PREFIX = "https://storage.yandex-team.ru/get-devtools/" - - -def parse_args(): + +import fetch_from + +MDS_PREFIX = "https://storage.yandex-team.ru/get-devtools/" + + +def parse_args(): parser = argparse.ArgumentParser() fetch_from.add_common_arguments(parser) - + parser.add_argument('--key', required=True) - - return parser.parse_args() - - -def fetch(key): - parts = key.split("/") - if len(parts) != 3: - raise ValueError("Invalid MDS key '{}'".format(key)) - - _, sha1, file_name = parts - - fetched_file = fetch_from.fetch_url(MDS_PREFIX + key, False, file_name, expected_sha1=sha1) - - return fetched_file, file_name - - + + return parser.parse_args() + + +def fetch(key): + parts = key.split("/") + if len(parts) != 3: + raise ValueError("Invalid MDS key '{}'".format(key)) + + _, sha1, file_name = parts + + fetched_file = fetch_from.fetch_url(MDS_PREFIX + key, False, file_name, expected_sha1=sha1) + + return fetched_file, file_name + + def main(args): fetched_file, resource_file_name = fetch(args.key) - + fetch_from.process(fetched_file, resource_file_name, args) - - -if __name__ == '__main__': + + +if __name__ == '__main__': args = parse_args() fetch_from.setup_logging(args, os.path.basename(__file__)) - - try: + + try: main(args) - except Exception as e: - logging.exception(e) + except Exception as e: + logging.exception(e) print >>sys.stderr, open(args.abs_log_path).read() - sys.stderr.flush() + sys.stderr.flush() import error sys.exit(error.ExitCodes.INFRASTRUCTURE_ERROR if fetch_from.is_temporary(e) else 1) |