From e43023520503903a1a2662679fe532acf9128996 Mon Sep 17 00:00:00 2001 From: Mark Dawson Date: Wed, 6 Sep 2023 10:58:55 +0100 Subject: [PATCH] fixed another style test failure --- cylc/uiserver/resolvers.py | 26 ++++++++++++-------------- cylc/uiserver/schema.py | 1 - 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/cylc/uiserver/resolvers.py b/cylc/uiserver/resolvers.py index 8e2a4cbb..ba64d107 100644 --- a/cylc/uiserver/resolvers.py +++ b/cylc/uiserver/resolvers.py @@ -287,7 +287,7 @@ async def scan( ): await workflows_mgr.scan() return cls._return("Workflow(s) scanned") - + @classmethod async def play(cls, workflows, args, workflows_mgr, log): """Calls `cylc play`.""" @@ -543,29 +543,27 @@ async def service( workflows: Iterable['Tokens'], kwargs: Dict[str, Any] ) -> List[Union[bool, str]]: - if command == 'clean': - return await Services.clean( + + SERVICES = { + 'clean': Services.clean( workflows, kwargs, self.workflows_mgr, log=self.log, executor=self.executor - ) - - elif command == 'play': - return await Services.play( + ), + 'play': Services.play( workflows, kwargs, self.workflows_mgr, - log=self.log - ) - - elif command == 'scan': - return await Services.scan( + log=self.log, + ), + 'scan': Services.scan( kwargs, self.workflows_mgr, - ) - # self.workflows_mgr.scan() + ), + } + return await SERVICES[command] raise NotImplementedError() diff --git a/cylc/uiserver/schema.py b/cylc/uiserver/schema.py index e8f24e83..34e39ecb 100644 --- a/cylc/uiserver/schema.py +++ b/cylc/uiserver/schema.py @@ -235,7 +235,6 @@ class Meta: ''') resolver = partial(mutator, command='clean') - class Arguments: workflows = graphene.List(WorkflowID, required=True) rm = graphene.String(