forked from M-Labs/artiq
1
0
Fork 0

scheduler: make asyncio loop a keyword-only argument, like in other asyncio APIs

This commit is contained in:
Sebastien Bourdeauducq 2023-01-11 18:45:35 +08:00
parent c8ab6c1b2b
commit 73a4ef89ec
2 changed files with 11 additions and 11 deletions

View File

@ -332,10 +332,10 @@ class Pipeline:
self._run = RunStage(self.pool, deleter.delete) self._run = RunStage(self.pool, deleter.delete)
self._analyze = AnalyzeStage(self.pool, deleter.delete) self._analyze = AnalyzeStage(self.pool, deleter.delete)
def start(self, loop=None): def start(self, *, loop=None):
self._prepare.start(loop) self._prepare.start(loop=loop)
self._run.start(loop) self._run.start(loop=loop)
self._analyze.start(loop) self._analyze.start(loop=loop)
async def stop(self): async def stop(self):
# NB: restart of a stopped pipeline is not supported # NB: restart of a stopped pipeline is not supported
@ -410,9 +410,9 @@ class Scheduler:
self._deleter = Deleter(self._pipelines) self._deleter = Deleter(self._pipelines)
self._log_submissions = log_submissions self._log_submissions = log_submissions
def start(self, loop=None): def start(self, *, loop=None):
self._loop = loop self._loop = loop
self._deleter.start(self._loop) self._deleter.start(loop=self._loop)
async def stop(self): async def stop(self):
# NB: restart of a stopped scheduler is not supported # NB: restart of a stopped scheduler is not supported

View File

@ -104,7 +104,7 @@ class SchedulerCase(unittest.TestCase):
done.set() done.set()
scheduler.notifier.publish = notify scheduler.notifier.publish = notify
scheduler.start(loop) scheduler.start(loop=loop)
# Verify that a timed experiment far in the future does not # Verify that a timed experiment far in the future does not
# get run, even if it has high priority. # get run, even if it has high priority.
@ -269,7 +269,7 @@ class SchedulerCase(unittest.TestCase):
done.set() done.set()
scheduler.notifier.publish = notify scheduler.notifier.publish = notify
scheduler.start(loop) scheduler.start(loop=loop)
scheduler.submit("main", expid_bg, low_priority) scheduler.submit("main", expid_bg, low_priority)
scheduler.submit("main", expid_empty, high_priority, late) scheduler.submit("main", expid_empty, high_priority, late)
@ -328,7 +328,7 @@ class SchedulerCase(unittest.TestCase):
empty_completed.set() empty_completed.set()
scheduler.notifier.publish = notify scheduler.notifier.publish = notify
scheduler.start(loop) scheduler.start(loop=loop)
scheduler.submit("main", expid_bg, -99, None, False) scheduler.submit("main", expid_bg, -99, None, False)
loop.run_until_complete(background_running.wait()) loop.run_until_complete(background_running.wait())
self.assertFalse(scheduler.check_pause(0)) self.assertFalse(scheduler.check_pause(0))
@ -379,7 +379,7 @@ class SchedulerCase(unittest.TestCase):
empty_ready.set() empty_ready.set()
scheduler.notifier.publish = notify scheduler.notifier.publish = notify
scheduler.start(loop) scheduler.start(loop=loop)
scheduler.submit("main", expid_bg, -99, None, False) scheduler.submit("main", expid_bg, -99, None, False)
loop.run_until_complete(background_running.wait()) loop.run_until_complete(background_running.wait())
@ -417,7 +417,7 @@ class SchedulerCase(unittest.TestCase):
done.set() done.set()
scheduler.notifier.publish = notify scheduler.notifier.publish = notify
scheduler.start(loop) scheduler.start(loop=loop)
scheduler.submit("main", expid, 0, None, False) scheduler.submit("main", expid, 0, None, False)
loop.run_until_complete(first_preparing.wait()) loop.run_until_complete(first_preparing.wait())
scheduler.submit("main", expid, 1, None, True) scheduler.submit("main", expid, 1, None, True)