From 3792019fac869e060f1e1e6cdbb0946d9f6318ca Mon Sep 17 00:00:00 2001 From: Eric Charles Date: Thu, 5 Oct 2023 17:51:19 -0700 Subject: [PATCH] change fullname behavior, add some stuff --- src/lsst/cmservice/cli/options.py | 2 +- src/lsst/cmservice/client.py | 4 ++-- src/lsst/cmservice/db/node.py | 14 +++++++------- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/lsst/cmservice/cli/options.py b/src/lsst/cmservice/cli/options.py index 7e6c1d0d7..2e8e569e8 100644 --- a/src/lsst/cmservice/cli/options.py +++ b/src/lsst/cmservice/cli/options.py @@ -53,7 +53,7 @@ class DictParamType(click.ParamType): name = "dictionary" - def convert(self, cli_value, param, ctx): + def convert(self, cli_value: Any, param: click.Parameter | None, ctx: click.Context | None) -> dict: """Converts CLI value to the dictionary structure. Args: diff --git a/src/lsst/cmservice/client.py b/src/lsst/cmservice/client.py index 1dbe414c0..4c8ecc1f8 100644 --- a/src/lsst/cmservice/client.py +++ b/src/lsst/cmservice/client.py @@ -217,7 +217,7 @@ def get_job_errors( fullname=fullname, ) query = "get/job/errors" - results = self._client.get(f"{query}", parans=params.dict()).json() + results = self._client.get(f"{query}", params=params.dict()).json() try: return parse_obj_as(list[models.ErrorInstance], results) except ValidationError as msg: @@ -269,7 +269,7 @@ def update_child_config( kwargs["node_type"] = kwargs["node_type"].value params = models.UpdateNodeQuery(**kwargs) print(params.dict()) - results = self._client.post(f"{query}", data=params.json()).json() + results = self._client.post(f"{query}", data=params.dict()).json() try: return parse_obj_as(dict, results) except ValidationError as msg: diff --git a/src/lsst/cmservice/db/node.py b/src/lsst/cmservice/db/node.py index 2af95ee10..9816ed5a7 100644 --- a/src/lsst/cmservice/db/node.py +++ b/src/lsst/cmservice/db/node.py @@ -244,7 +244,7 @@ async def update_collections( self, session: async_scoped_session, **kwargs: Any, - ) -> dict: + ) -> NodeMixin: """Update the collection configuration associated to a particular row @@ -358,8 +358,8 @@ async def reject( if self.status in [StatusEnum.accepted, StatusEnum.rescued]: raise ValueError(f"Can not reject {self} as it is in status {self.status}") - await self.update_values(status=StatusEnum.rejected) - await self.commit() + await self.update_values(session, status=StatusEnum.rejected) + await session.commit() return self async def accept( @@ -381,8 +381,8 @@ async def accept( if self.status in [StatusEnum.running, StatusEnum.reviewable, StatusEnum.rescuable]: raise ValueError(f"Can not accept {self} as it is in status {self.status}") - await self.update_values(status=StatusEnum.accepted) - await self.commit() + await self.update_values(session, status=StatusEnum.accepted) + await session.commit() return self async def reset( @@ -405,8 +405,8 @@ async def reset( raise ValueError(f"Can not reset {self} as it is in status {self.status}") await self._clean_up_node(session) - await self.update_values(status=StatusEnum.waiting, superseded=False) - await self.commit() + await self.update_values(session, status=StatusEnum.waiting, superseded=False) + await session.commit() return self async def _clean_up_node(