(cls: Type[ServiceSpecT], json_spec: dict)
| 1172 | |
| 1173 | @classmethod |
| 1174 | def _from_json_impl(cls: Type[ServiceSpecT], json_spec: dict) -> ServiceSpecT: |
| 1175 | args = {} # type: Dict[str, Any] |
| 1176 | for k, v in json_spec.items(): |
| 1177 | if k == 'placement': |
| 1178 | v = PlacementSpec.from_json(v) |
| 1179 | if k == 'custom_configs': |
| 1180 | v = [CustomConfig.from_json(c) for c in v] |
| 1181 | if k == 'spec': |
| 1182 | args.update(v) |
| 1183 | continue |
| 1184 | args.update({k: v}) |
| 1185 | _cls = cls(**args) |
| 1186 | if _service_spec_from_json_validate: |
| 1187 | _cls.validate() |
| 1188 | return _cls |
| 1189 | |
| 1190 | def service_name(self) -> str: |
| 1191 | n = self.service_type |
no test coverage detected