From 73a4ef89ec3dd5a4dbdcde22fcd83340d8869d4c Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 11 Jan 2023 18:45:35 +0800 Subject: [PATCH] scheduler: make asyncio loop a keyword-only argument, like in other asyncio APIs --- artiq/master/scheduler.py | 12 ++++++------ artiq/test/test_scheduler.py | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/artiq/master/scheduler.py b/artiq/master/scheduler.py index d849880fe..1a18c0720 100644 --- a/artiq/master/scheduler.py +++ b/artiq/master/scheduler.py @@ -332,10 +332,10 @@ class Pipeline: self._run = RunStage(self.pool, deleter.delete) self._analyze = AnalyzeStage(self.pool, deleter.delete) - def start(self, loop=None): - self._prepare.start(loop) - self._run.start(loop) - self._analyze.start(loop) + def start(self, *, loop=None): + self._prepare.start(loop=loop) + self._run.start(loop=loop) + self._analyze.start(loop=loop) async def stop(self): # NB: restart of a stopped pipeline is not supported @@ -410,9 +410,9 @@ class Scheduler: self._deleter = Deleter(self._pipelines) self._log_submissions = log_submissions - def start(self, loop=None): + def start(self, *, loop=None): self._loop = loop - self._deleter.start(self._loop) + self._deleter.start(loop=self._loop) async def stop(self): # NB: restart of a stopped scheduler is not supported diff --git a/artiq/test/test_scheduler.py b/artiq/test/test_scheduler.py index 5ed6cc01a..9726190ed 100644 --- a/artiq/test/test_scheduler.py +++ b/artiq/test/test_scheduler.py @@ -104,7 +104,7 @@ class SchedulerCase(unittest.TestCase): done.set() scheduler.notifier.publish = notify - scheduler.start(loop) + scheduler.start(loop=loop) # Verify that a timed experiment far in the future does not # get run, even if it has high priority. @@ -269,7 +269,7 @@ class SchedulerCase(unittest.TestCase): done.set() scheduler.notifier.publish = notify - scheduler.start(loop) + scheduler.start(loop=loop) scheduler.submit("main", expid_bg, low_priority) scheduler.submit("main", expid_empty, high_priority, late) @@ -328,7 +328,7 @@ class SchedulerCase(unittest.TestCase): empty_completed.set() scheduler.notifier.publish = notify - scheduler.start(loop) + scheduler.start(loop=loop) scheduler.submit("main", expid_bg, -99, None, False) loop.run_until_complete(background_running.wait()) self.assertFalse(scheduler.check_pause(0)) @@ -379,7 +379,7 @@ class SchedulerCase(unittest.TestCase): empty_ready.set() scheduler.notifier.publish = notify - scheduler.start(loop) + scheduler.start(loop=loop) scheduler.submit("main", expid_bg, -99, None, False) loop.run_until_complete(background_running.wait()) @@ -417,7 +417,7 @@ class SchedulerCase(unittest.TestCase): done.set() scheduler.notifier.publish = notify - scheduler.start(loop) + scheduler.start(loop=loop) scheduler.submit("main", expid, 0, None, False) loop.run_until_complete(first_preparing.wait()) scheduler.submit("main", expid, 1, None, True)