|
9 | 9 | from io import BytesIO
|
10 | 10 | from pathlib import Path
|
11 | 11 | from time import sleep, strftime, gmtime
|
12 |
| -from typing import Union, IO, Optional, Mapping |
| 12 | +from typing import Union, IO, Optional |
13 | 13 |
|
14 | 14 | import docker
|
15 | 15 | import requests
|
|
19 | 19 | from cryptography.hazmat.primitives.asymmetric import ec
|
20 | 20 |
|
21 | 21 | from vespa.application import Vespa
|
22 |
| -from vespa.json_serialization import ToJson, FromJson |
23 | 22 | from vespa.package import ApplicationPackage
|
24 | 23 |
|
25 | 24 | CFG_SERVER_START_TIMEOUT = 300
|
26 | 25 | APP_INIT_TIMEOUT = 300
|
27 | 26 | DOCKER_TIMEOUT = 600
|
28 | 27 |
|
29 | 28 |
|
30 |
| -class VespaDocker(ToJson, FromJson["VespaDocker"]): |
| 29 | +class VespaDocker(object): |
31 | 30 | def __init__(
|
32 | 31 | self,
|
33 | 32 | port: int = 8080,
|
@@ -310,45 +309,6 @@ def restart_services(self):
|
310 | 309 | self.stop_services()
|
311 | 310 | self.start_services()
|
312 | 311 |
|
313 |
| - @staticmethod |
314 |
| - def from_dict(mapping: Mapping) -> "VespaDocker": |
315 |
| - try: |
316 |
| - if mapping["container_id"] is not None: |
317 |
| - vespa_docker = VespaDocker.from_container_name_or_id( |
318 |
| - name_or_id=mapping["container_id"] |
319 |
| - ) |
320 |
| - return vespa_docker |
321 |
| - elif mapping["container_name"] is not None: |
322 |
| - vespa_docker = VespaDocker.from_container_name_or_id( |
323 |
| - name_or_id=mapping["container_name"] |
324 |
| - ) |
325 |
| - return vespa_docker |
326 |
| - else: |
327 |
| - print( |
328 |
| - "Unable to instantiate VespaDocker from a running container. Starting new container." |
329 |
| - ) |
330 |
| - except ValueError: |
331 |
| - print( |
332 |
| - "Unable to instantiate VespaDocker from a running container. Starting new container." |
333 |
| - ) |
334 |
| - vespa_docker = VespaDocker( |
335 |
| - port=mapping["port"], |
336 |
| - container_memory=mapping["container_memory"], |
337 |
| - container_image=mapping["container_image"], |
338 |
| - ) |
339 |
| - return vespa_docker |
340 |
| - |
341 |
| - @property |
342 |
| - def to_dict(self) -> Mapping: |
343 |
| - return { |
344 |
| - "container_id": self.container_id, |
345 |
| - "container_name": self.container_name, |
346 |
| - "url": self.url, |
347 |
| - "port": self.local_port, |
348 |
| - "container_memory": self.container_memory, |
349 |
| - "container_image": self.container_image, |
350 |
| - } |
351 |
| - |
352 | 312 | def __eq__(self, other):
|
353 | 313 | if not isinstance(other, self.__class__):
|
354 | 314 | return False
|
|
0 commit comments