def main(): # Init state config = configparser.ConfigParser() config.read(['nipa.config', 'pw.config', 'upload.config']) log_init(config.get('log', 'type', fallback='org'), config.get('log', 'file', fallback=os.path.join(NIPA_DIR, "upload.org")), force_single_thread=True) results_dir = config.get('results', 'dir', fallback=os.path.join(NIPA_DIR, "results")) pw = Patchwork(config) signal.signal(signal.SIGTERM, handler) signal.signal(signal.SIGINT, handler) tw = TestWatcher(results_dir, '.tester_done', '.pw_done', pw_upload_results_cb, { 'pw': pw, 'config': config }) tw.initial_scan() tw.watch()
def __init__(self) -> None: config = configparser.ConfigParser() config.read(['nipa.config', 'pw.config', 'poller.config']) log_init( config.get('log', 'type', fallback='org'), config.get('log', 'file', fallback=os.path.join(NIPA_DIR, "poller.org"))) # TODO: make this non-static / read from a config self._trees = { "net-next": Tree("net-next", "net-next", "../net-next", "net-next"), "net": Tree("net", "net", "../net", "net"), "bpf-next": Tree("bpf-next", "bpf-next", "../bpf-next", "bpf-next"), "bpf": Tree("bpf", "bpf", "../bpf", "bpf"), } self.result_dir = config.get('results', 'dir', fallback=os.path.join( NIPA_DIR, "results")) self._barrier = threading.Barrier(len(self._trees) + 1) self._done_queue = queue.Queue() self._workers = {} for k, tree in self._trees.items(): self._workers[k] = Tester(self.result_dir, tree, queue.Queue(), self._done_queue, self._barrier) self._workers[k].start() log(f"Started worker {self._workers[k].name} for {k}") self._pw = Patchwork(config) self._state = { 'last_poll': (datetime.datetime.utcnow() - datetime.timedelta(hours=2)).timestamp(), 'done_series': [], } self.init_state_from_disk() self.seen_series = set(self._state['done_series']) self.done_series = self.seen_series.copy()
def main(): # Init state config = configparser.ConfigParser() config.read(['nipa.config', 'pw.config', 'upload.config']) log_init( config.get('log', 'type', fallback='org'), config.get('log', 'file', fallback=os.path.join(NIPA_DIR, "upload.org"))) results_dir = config.get('results', 'dir', fallback=os.path.join(NIPA_DIR, "results")) pw = Patchwork(config) # Initial walk initial_scan(results_dir, pw, config) # Watcher watch_scan(results_dir, pw, config)
def run(self) -> None: config = configparser.ConfigParser() config.read(['nipa.config', 'pw.config', 'tester.config']) core.log_init( config.get('log', 'type', fallback='org'), config.get('log', 'file', fallback=os.path.join(core.NIPA_DIR, f"{self.tree.name}.org"))) core.log_open_sec("Tester init") if not os.path.exists(self.result_dir): os.makedirs(self.result_dir) tests_dir = os.path.abspath(core.CORE_DIR + "../../tests") self.series_tests = load_tests(tests_dir, "series") self.patch_tests = load_tests(tests_dir, "patch") core.log_end_sec() while not self.should_die: self.barrier.wait() while not self.should_die and not self.queue.empty(): s = self.queue.get() if s is None: continue self.test_series(self.tree, s) self.done_queue.put(s) # If we're the last worker with work to do - let the poller run core.log( f"Checking barrier {self.barrier.n_waiting}/{self.barrier.parties} " ) if self.barrier.parties == self.barrier.n_waiting + 1: break self.barrier.wait()
from core import NIPA_DIR from core import log, log_open_sec, log_end_sec, log_init from core import Tester from core import Tree from pw import Patchwork from pw import PwSeries import netdev # Init state config = configparser.ConfigParser() config.read(['nipa.config', 'pw.config', 'poller.config']) log_init( config.get('log', 'type', fallback='org'), config.get('log', 'file', fallback=os.path.join(NIPA_DIR, "poller.org"))) state = { 'last_poll': str(datetime.datetime.utcnow() - datetime.timedelta(days=3)), 'last_id': 0, } trees = { "net-next": Tree("net-next", "net-next", "net-next", "net-next"), "bpf-next": Tree("bpf-next", "bpf-next", "bpf-next", "bpf-next"), "net": Tree("net", "net", "net", "net"), "bpf": Tree("bpf", "bpf", "bpf", "bpf") } tester = Tester(