diff options
author | nalpp <nalpp@yandex-team.ru> | 2022-02-10 16:46:45 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:45 +0300 |
commit | 87f3eb38999df2d3c1cb77f8ffb9c52ec9c516fb (patch) | |
tree | f4ab0734eecf35b22f21952d1aa15496f267a6a3 /build/scripts | |
parent | 198698b9c1e18958addc9682fbfba4576d604757 (diff) | |
download | ydb-87f3eb38999df2d3c1cb77f8ffb9c52ec9c516fb.tar.gz |
Restoring authorship annotation for <nalpp@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'build/scripts')
-rw-r--r-- | build/scripts/compile_cuda.py | 4 | ||||
-rw-r--r-- | build/scripts/coverage-info.py | 6 | ||||
-rwxr-xr-x | build/scripts/fetch_from_sandbox.py | 60 | ||||
-rw-r--r-- | build/scripts/move.py | 30 | ||||
-rw-r--r-- | build/scripts/python_yndexer.py | 100 | ||||
-rw-r--r-- | build/scripts/run_msvc_wine.py | 2 | ||||
-rw-r--r-- | build/scripts/yndexer.py | 94 |
7 files changed, 148 insertions, 148 deletions
diff --git a/build/scripts/compile_cuda.py b/build/scripts/compile_cuda.py index c0bec50b2a..ebbaa9610e 100644 --- a/build/scripts/compile_cuda.py +++ b/build/scripts/compile_cuda.py @@ -60,8 +60,8 @@ def main(): skip_list.append('-nostdinc++') for flag in skip_list: - if flag in cflags: - cflags.remove(flag) + if flag in cflags: + cflags.remove(flag) skip_prefix_list = [ '-fsanitize=', diff --git a/build/scripts/coverage-info.py b/build/scripts/coverage-info.py index 94491d9256..f5452c893e 100644 --- a/build/scripts/coverage-info.py +++ b/build/scripts/coverage-info.py @@ -242,9 +242,9 @@ def main(source_root, output, gcno_archive, gcda_archive, gcov_tool, prefix_filt else: output_dir = output + '.dir' - if not os.path.exists(output_dir): - os.makedirs(output_dir) - + if not os.path.exists(output_dir): + os.makedirs(output_dir) + teamcity_stat_file = None if teamcity_stat_output: teamcity_stat_file = os.path.join(output_dir, 'teamcity.out') diff --git a/build/scripts/fetch_from_sandbox.py b/build/scripts/fetch_from_sandbox.py index a99542e174..a71259e45c 100755 --- a/build/scripts/fetch_from_sandbox.py +++ b/build/scripts/fetch_from_sandbox.py @@ -31,14 +31,14 @@ class ResourceInfoError(Exception): pass -class UnsupportedProtocolException(Exception): - pass - - +class UnsupportedProtocolException(Exception): + pass + + def _sky_path(): return "/usr/local/bin/sky" - - + + def _is_skynet_avaliable(): if not os.path.exists(_sky_path()): return False @@ -52,28 +52,28 @@ def _is_skynet_avaliable(): def download_by_skynet(resource_info, file_name): - def sky_get(skynet_id, target_dir, timeout=None): + def sky_get(skynet_id, target_dir, timeout=None): cmd_args = [_sky_path(), 'get', "-N", "Backbone", "--user", "--wait", "--dir", target_dir, skynet_id] - if timeout is not None: - cmd_args += ["--timeout", str(timeout)] + if timeout is not None: + cmd_args += ["--timeout", str(timeout)] logging.info('Call skynet with args: %s', cmd_args) - stdout = subprocess.check_output(cmd_args).strip() - logging.debug('Skynet call with args %s is finished, result is %s', cmd_args, stdout) - return stdout - + stdout = subprocess.check_output(cmd_args).strip() + logging.debug('Skynet call with args %s is finished, result is %s', cmd_args, stdout) + return stdout + if not _is_skynet_avaliable(): - raise UnsupportedProtocolException("Skynet is not available") - - skynet_id = resource_info.get("skynet_id") - if not skynet_id: - raise ValueError("Resource does not have skynet_id") - + raise UnsupportedProtocolException("Skynet is not available") + + skynet_id = resource_info.get("skynet_id") + if not skynet_id: + raise ValueError("Resource does not have skynet_id") + temp_dir = os.path.abspath(fetch_from.uniq_string_generator()) - os.mkdir(temp_dir) - sky_get(skynet_id, temp_dir) - return os.path.join(temp_dir, file_name) - - + os.mkdir(temp_dir) + sky_get(skynet_id, temp_dir) + return os.path.join(temp_dir, file_name) + + def _urlopen(url, data=None, headers=None): n = 10 tout = 30 @@ -154,11 +154,11 @@ def fetch(resource_id, custom_fetcher): mds_id = resource_info.get('attributes', {}).get('mds') mds_link = MDS_PREFIX + mds_id if mds_id else None - def get_storage_links(): - storage_links = get_resource_http_links(resource_id) - random.shuffle(storage_links) - return storage_links - + def get_storage_links(): + storage_links = get_resource_http_links(resource_id) + random.shuffle(storage_links) + return storage_links + skynet = _is_skynet_avaliable() if not skynet: @@ -173,7 +173,7 @@ def fetch(resource_id, custom_fetcher): # Don't try too hard here: we will get back to proxy later on yield lambda: fetch_from.fetch_url(proxy_link, False, resource_file_name, expected_md5, tries=2) - for x in get_storage_links(): + for x in get_storage_links(): # Don't spend too much time connecting single host yield lambda: fetch_from.fetch_url(x, False, resource_file_name, expected_md5, tries=1) if mds_link is not None: diff --git a/build/scripts/move.py b/build/scripts/move.py index 3f611fbc2e..d710c493cd 100644 --- a/build/scripts/move.py +++ b/build/scripts/move.py @@ -1,15 +1,15 @@ -import os -import sys - -# /script/move.py <src-1> <tgt-1> <src-2> <tgt-2> ... <src-n> <tgt-n> -# renames src-1 to tgt-1, src-2 to tgt-2, ..., src-n to tgt-n. - - -def main(): - assert len(sys.argv) % 2 == 1 - for index in range(1, len(sys.argv), 2): - os.rename(sys.argv[index], sys.argv[index + 1]) - - -if __name__ == '__main__': - main() +import os +import sys + +# /script/move.py <src-1> <tgt-1> <src-2> <tgt-2> ... <src-n> <tgt-n> +# renames src-1 to tgt-1, src-2 to tgt-2, ..., src-n to tgt-n. + + +def main(): + assert len(sys.argv) % 2 == 1 + for index in range(1, len(sys.argv), 2): + os.rename(sys.argv[index], sys.argv[index + 1]) + + +if __name__ == '__main__': + main() diff --git a/build/scripts/python_yndexer.py b/build/scripts/python_yndexer.py index 3180665387..2ffcb104f4 100644 --- a/build/scripts/python_yndexer.py +++ b/build/scripts/python_yndexer.py @@ -1,53 +1,53 @@ -import os -import sys -import threading -import subprocess - - -def _try_to_kill(process): - try: - process.kill() - except Exception: - pass - - -def touch(path): - if not os.path.exists(path): - with open(path, 'w') as _: - pass - - -class Process(object): - def __init__(self, args): - self._process = subprocess.Popen(args) - self._event = threading.Event() - self._result = None - thread = threading.Thread(target=self._run) - thread.setDaemon(True) - thread.start() - - def _run(self): - self._process.communicate() - self._result = self._process.returncode - self._event.set() - - def wait(self, timeout): - self._event.wait(timeout=timeout) - _try_to_kill(self._process) - return self._result - - -if __name__ == '__main__': - yndexer = sys.argv[1] - timeout = int(sys.argv[2]) - output_file = sys.argv[3] - input_file = sys.argv[4] +import os +import sys +import threading +import subprocess + + +def _try_to_kill(process): + try: + process.kill() + except Exception: + pass + + +def touch(path): + if not os.path.exists(path): + with open(path, 'w') as _: + pass + + +class Process(object): + def __init__(self, args): + self._process = subprocess.Popen(args) + self._event = threading.Event() + self._result = None + thread = threading.Thread(target=self._run) + thread.setDaemon(True) + thread.start() + + def _run(self): + self._process.communicate() + self._result = self._process.returncode + self._event.set() + + def wait(self, timeout): + self._event.wait(timeout=timeout) + _try_to_kill(self._process) + return self._result + + +if __name__ == '__main__': + yndexer = sys.argv[1] + timeout = int(sys.argv[2]) + output_file = sys.argv[3] + input_file = sys.argv[4] partition_count = sys.argv[5] partition_index = sys.argv[6] - + process = Process([yndexer, '-f', input_file, '-y', output_file, '-c', partition_count, '-i', partition_index]) - result = process.wait(timeout=timeout) - - if result != 0: - print >> sys.stderr, 'Yndexing process finished with code', result - touch(output_file) + result = process.wait(timeout=timeout) + + if result != 0: + print >> sys.stderr, 'Yndexing process finished with code', result + touch(output_file) diff --git a/build/scripts/run_msvc_wine.py b/build/scripts/run_msvc_wine.py index 439d1f8831..885f6250db 100644 --- a/build/scripts/run_msvc_wine.py +++ b/build/scripts/run_msvc_wine.py @@ -470,7 +470,7 @@ def run_main(): 'tout': tout } - slave_cmd = [sys.executable, sys.argv[0], wine, 'slave', json.dumps(args)] + slave_cmd = [sys.executable, sys.argv[0], wine, 'slave', json.dumps(args)] p = run_subprocess(slave_cmd, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, shell=False) out, _ = p.communicate() return p.wait(), out diff --git a/build/scripts/yndexer.py b/build/scripts/yndexer.py index a38e28ba99..007724d9a3 100644 --- a/build/scripts/yndexer.py +++ b/build/scripts/yndexer.py @@ -1,56 +1,56 @@ import sys import subprocess -import threading +import threading import os import re - + rx_resource_dir = re.compile(r'libraries: =([^:]*)') - -def _try_to_kill(process): - try: - process.kill() - except Exception: - pass - - -def touch(path): - if not os.path.exists(path): + +def _try_to_kill(process): + try: + process.kill() + except Exception: + pass + + +def touch(path): + if not os.path.exists(path): with open(path, 'w'): - pass - - -class Process(object): - def __init__(self, args): - self._process = subprocess.Popen(args) - self._event = threading.Event() - self._result = None - thread = threading.Thread(target=self._run) - thread.setDaemon(True) - thread.start() - - def _run(self): - self._process.communicate() - self._result = self._process.returncode - self._event.set() - - def wait(self, timeout): - self._event.wait(timeout=timeout) - _try_to_kill(self._process) - return self._result - - + pass + + +class Process(object): + def __init__(self, args): + self._process = subprocess.Popen(args) + self._event = threading.Event() + self._result = None + thread = threading.Thread(target=self._run) + thread.setDaemon(True) + thread.start() + + def _run(self): + self._process.communicate() + self._result = self._process.returncode + self._event.set() + + def wait(self, timeout): + self._event.wait(timeout=timeout) + _try_to_kill(self._process) + return self._result + + if __name__ == '__main__': args = sys.argv yndexer = args[1] - timeout = int(args[2]) - arc_root = args[3] - build_root = args[4] - input_file = args[5] - output_file = args[-1] - tail_args = args[6:-1] + timeout = int(args[2]) + arc_root = args[3] + build_root = args[4] + input_file = args[5] + output_file = args[-1] + tail_args = args[6:-1] subprocess.check_call(tail_args) @@ -71,9 +71,9 @@ if __name__ == '__main__': '-resource-dir', resource_dir, ] - process = Process(yndexer_args) - result = process.wait(timeout=timeout) - - if result != 0: - print >> sys.stderr, 'Yndexing process finished with code', result - touch(output_file) + process = Process(yndexer_args) + result = process.wait(timeout=timeout) + + if result != 0: + print >> sys.stderr, 'Yndexing process finished with code', result + touch(output_file) |