Skip to content

Commit

Permalink
Print missing fields for failed compute env creation
Browse files Browse the repository at this point in the history
  • Loading branch information
jennydaman committed Oct 15, 2023
1 parent e9361d0 commit aeb33ed
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
5 changes: 3 additions & 2 deletions chrisomatic/core/computeenvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@ async def run(self, status: Channel) -> tuple[Outcome, Optional[ComputeResource]
f'Existing "{preexisting.name}" ' "is different from given_config."
)
return Outcome.FAILED, preexisting
if not self.given.is_some():
status.replace(f'No configuration for "{self.given.name}"')
missing = self.given.get_missing()
if missing:
status.replace(f"Missing configurations: {missing}")
return Outcome.FAILED, None
created_compute_resource = await self.cube.create_compute_resource(
name=self.given.name,
Expand Down
6 changes: 3 additions & 3 deletions chrisomatic/spec/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from serde import serde
from aiochris.types import Username, Password, ComputeResourceName, PfconUrl
from dataclasses import dataclass, astuple
from dataclasses import dataclass, astuple, asdict


@serde
Expand All @@ -29,8 +29,8 @@ class ComputeResource:
description: Optional[str] = None
innetwork: Optional[bool] = None

def is_some(self) -> bool:
return all(f is not None for f in astuple(self))
def get_missing(self) -> list[str]:
return [k for k, v in asdict(self).items() if v is None]


@serde
Expand Down
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "chrisomatic"
version = "0.7.0"
version = "0.7.1"
description = "ChRIS backend provisioner with Powerpointlessness"
authors = ["Jennings Zhang <Jennings.Zhang@childrens.harvard.edu>"]
license = "MIT"
Expand Down

0 comments on commit aeb33ed

Please sign in to comment.