aboutsummaryrefslogtreecommitdiffstats
path: root/build/scripts/python_yndexer.py
diff options
context:
space:
mode:
authornalpp <nalpp@yandex-team.ru>2022-02-10 16:46:46 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:46 +0300
commit30d1ef3941e0dc835be7609de5ebee66958f215a (patch)
tree49e222ea1c5804306084bb3ae065bb702625360f /build/scripts/python_yndexer.py
parent87f3eb38999df2d3c1cb77f8ffb9c52ec9c516fb (diff)
downloadydb-30d1ef3941e0dc835be7609de5ebee66958f215a.tar.gz
Restoring authorship annotation for <nalpp@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'build/scripts/python_yndexer.py')
-rw-r--r--build/scripts/python_yndexer.py100
1 files changed, 50 insertions, 50 deletions
diff --git a/build/scripts/python_yndexer.py b/build/scripts/python_yndexer.py
index 2ffcb104f4..3180665387 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)