Skip to content

Commit

Permalink
corrected to_json in ServiceSpec
Browse files Browse the repository at this point in the history
  • Loading branch information
mdorier committed Jul 24, 2024
1 parent a376497 commit 4355942
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions python/mochi/bedrock/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -2219,7 +2219,7 @@ def validate(self) -> NoReturn:
f'module type {p.name}')

@staticmethod
def space(provider_space_factories: list[tuple[str, 'ConfigurationSpace', int|tuple[int,int]]] = [],
def space(provider_space_factories: list[dict] = [],
**kwargs):
"""
The provider_space_factories argument is a list of dictionaries with the following format.
Expand Down Expand Up @@ -2355,13 +2355,14 @@ def from_dict(data: dict) -> 'ProcSpec':
def to_json(self, *args, **kwargs) -> str:
"""Convert the ProcSpec into a JSON string.
"""
return json.dumps(self.to_dict(), *args, **kwargs)
return json.dumps(self.to_dict()['processes'], *args, **kwargs)

@staticmethod
def from_json(json_string: str) -> 'ServiceSpec':
"""Construct a ServiceSpec from a JSON string.
"""
return ServiceSpec.from_dict(json.loads(json_string))
cfg = {'processes': json.loads(json_string)}
return ServiceSpec.from_dict(cfg)

def validate(self) -> NoReturn:
"""Validate the state of the ServiceSpec.
Expand Down

0 comments on commit 4355942

Please sign in to comment.