diff options
author | yazevnul <yazevnul@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:46 +0300 |
commit | 8cbc307de0221f84c80c42dcbe07d40727537e2c (patch) | |
tree | 625d5a673015d1df891e051033e9fcde5c7be4e5 /build | |
parent | 30d1ef3941e0dc835be7609de5ebee66958f215a (diff) | |
download | ydb-8cbc307de0221f84c80c42dcbe07d40727537e2c.tar.gz |
Restoring authorship annotation for <yazevnul@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'build')
-rwxr-xr-x | build/scripts/fetch_from_sandbox.py | 66 | ||||
-rw-r--r-- | build/stdafx.hpp | 4 | ||||
-rw-r--r-- | build/ya.conf.json | 78 |
3 files changed, 74 insertions, 74 deletions
diff --git a/build/scripts/fetch_from_sandbox.py b/build/scripts/fetch_from_sandbox.py index a99542e174..7c67b5b213 100755 --- a/build/scripts/fetch_from_sandbox.py +++ b/build/scripts/fetch_from_sandbox.py @@ -1,14 +1,14 @@ -import itertools -import json -import logging +import itertools +import json +import logging import argparse -import os +import os import random -import subprocess +import subprocess import sys import time -import urllib2 -import uuid +import urllib2 +import uuid import fetch_from @@ -74,25 +74,25 @@ def download_by_skynet(resource_info, file_name): return os.path.join(temp_dir, file_name) -def _urlopen(url, data=None, headers=None): +def _urlopen(url, data=None, headers=None): n = 10 - tout = 30 - started = time.time() - reqid = uuid.uuid4() - - request = urllib2.Request(url, data=data, headers=headers or {}) - request.add_header('X-Request-Timeout', str(tout)) - request.add_header('X-Request-Id', str(reqid)) - request.add_header('User-Agent', 'fetch_from_sandbox.py') + tout = 30 + started = time.time() + reqid = uuid.uuid4() + + request = urllib2.Request(url, data=data, headers=headers or {}) + request.add_header('X-Request-Timeout', str(tout)) + request.add_header('X-Request-Id', str(reqid)) + request.add_header('User-Agent', 'fetch_from_sandbox.py') for i in xrange(n): - retry_after = i + retry_after = i try: - request.add_header('X-Request-Duration', str(int(time.time() - started))) - return urllib2.urlopen(request, timeout=tout).read() + request.add_header('X-Request-Duration', str(int(time.time() - started))) + return urllib2.urlopen(request, timeout=tout).read() except urllib2.HTTPError as e: logging.warning('failed to fetch URL %s with HTTP code %d: %s', url, e.code, e) - retry_after = int(e.headers.get('Retry-After', str(retry_after))) + retry_after = int(e.headers.get('Retry-After', str(retry_after))) if e.code not in TEMPORARY_ERROR_CODES: raise @@ -103,29 +103,29 @@ def _urlopen(url, data=None, headers=None): if i + 1 == n: raise e - time.sleep(retry_after) + time.sleep(retry_after) def _query(url): return json.loads(_urlopen(url)) -_SANDBOX_BASE_URL = 'https://sandbox.yandex-team.ru/api/v1.0' +_SANDBOX_BASE_URL = 'https://sandbox.yandex-team.ru/api/v1.0' -def get_resource_info(resource_id, touch=False, no_links=False): - url = ''.join((_SANDBOX_BASE_URL, '/resource/', str(resource_id))) - headers = {} - if touch: - headers.update({'X-Touch-Resource': '1'}) - if no_links: - headers.update({'X-No-Links': '1'}) - return _query(url) +def get_resource_info(resource_id, touch=False, no_links=False): + url = ''.join((_SANDBOX_BASE_URL, '/resource/', str(resource_id))) + headers = {} + if touch: + headers.update({'X-Touch-Resource': '1'}) + if no_links: + headers.update({'X-No-Links': '1'}) + return _query(url) def get_resource_http_links(resource_id): - url = ''.join((_SANDBOX_BASE_URL, '/resource/', str(resource_id), '/data/http')) - return [r['url'] + ORIGIN_SUFFIX for r in _query(url)] + url = ''.join((_SANDBOX_BASE_URL, '/resource/', str(resource_id), '/data/http')) + return [r['url'] + ORIGIN_SUFFIX for r in _query(url)] def fetch_via_script(script, resource_id): @@ -134,7 +134,7 @@ def fetch_via_script(script, resource_id): def fetch(resource_id, custom_fetcher): try: - resource_info = get_resource_info(resource_id, touch=True, no_links=True) + resource_info = get_resource_info(resource_id, touch=True, no_links=True) except Exception as e: sys.stderr.write( "Failed to fetch resource {}: {}\n".format(resource_id, str(e)) diff --git a/build/stdafx.hpp b/build/stdafx.hpp index 98b15adda0..7933ce4cc6 100644 --- a/build/stdafx.hpp +++ b/build/stdafx.hpp @@ -289,7 +289,7 @@ #include <util/stream/input.h> #include <util/stream/trace.h> #include <util/stream/output.h> -#include <util/stream/output.h> +#include <util/stream/output.h> #include <util/stream/format.h> #include <util/stream/tee.h> #include <util/stream/multi.h> @@ -306,7 +306,7 @@ #include <util/stream/str.h> #include <util/stream/file.h> #include <util/stream/zerocopy.h> -#include <util/stream/output.h> +#include <util/stream/output.h> #include <util/random/common_ops.h> #include <util/random/shuffle.h> #include <util/random/lcg_engine.h> diff --git a/build/ya.conf.json b/build/ya.conf.json index 5f7cc875d6..9161ba0392 100644 --- a/build/ya.conf.json +++ b/build/ya.conf.json @@ -3023,14 +3023,14 @@ } ] }, - "transfer-manager": { - "tools": { + "transfer-manager": { + "tools": { "transfer-manager": { "bottle": "transfer-manager", "executable": "transfer-manager" } - }, - "platforms": [ + }, + "platforms": [ { "host": { "os": "DARWIN" @@ -3049,16 +3049,16 @@ }, "default": true } - ] - }, - "rem-tool": { - "tools": { + ] + }, + "rem-tool": { + "tools": { "rem-tool": { "bottle": "rem-tool", "executable": "rem-tool" } - }, - "platforms": [ + }, + "platforms": [ { "host": { "os": "DARWIN" @@ -3077,8 +3077,8 @@ }, "default": true } - ] - }, + ] + }, "uc": { "tools": { "uc": { @@ -3732,13 +3732,13 @@ } ] }, - "tmux": { - "tools": { + "tmux": { + "tools": { "tmux": { "bottle": "tmux", "executable": "tmux" } - }, + }, "env": { "TERMINFO": [ "$(ROOT)/share/terminfo" @@ -3752,7 +3752,7 @@ "default": true } ] - }, + }, "rsync": { "tools": { "rsync": { @@ -6565,28 +6565,28 @@ ] } }, - "transfer-manager": { - "formula": { - "sandbox_id": 135979123, - "match": "transfer-manager" - }, - "executable": { + "transfer-manager": { + "formula": { + "sandbox_id": 135979123, + "match": "transfer-manager" + }, + "executable": { "transfer-manager": [ "transfer-manager" ] - } - }, - "rem-tool": { - "formula": { - "sandbox_id": 79265295, - "match": "rem-tool" - }, - "executable": { + } + }, + "rem-tool": { + "formula": { + "sandbox_id": 79265295, + "match": "rem-tool" + }, + "executable": { "rem-tool": [ "rem-tool" ] - } - }, + } + }, "uc": { "formula": { "sandbox_id": 505682252, @@ -6909,20 +6909,20 @@ ] } }, - "tmux": { - "formula": { + "tmux": { + "formula": { "sandbox_id": [ 1105659071 ], - "match": "tmux" - }, - "executable": { + "match": "tmux" + }, + "executable": { "tmux": [ "bin", "tmux" ] - } - }, + } + }, "optrace": { "formula": { "sandbox_id": [ |