runtime
Runtime
Runtime(containers: List[Container], interval: float = 0.5)
Bases: ABC
Initializes the Runtime with a list of containers.
Parameters:
-
containers(List[Container]) –A list of Container instances to manage. Each container must have been created (i.e. container.is_created is True).
Examples:
>>> runtime = SomeRuntime([container1, container2])
Source code in ures/docker/runtime.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
run
abstractmethod
run(*args, **kwargs)
Run all managed containers.
Examples:
>>> runtime.run()
Source code in ures/docker/runtime.py
31 32 33 34 35 36 37 38 39 | |
stop
abstractmethod
stop(*args, **kwargs)
Stop all managed containers.
Examples:
>>> runtime.stop()
Source code in ures/docker/runtime.py
41 42 43 44 45 46 47 48 49 | |
remove
abstractmethod
remove(*args, **kwargs)
Remove all managed containers.
Examples:
>>> runtime.remove()
Source code in ures/docker/runtime.py
51 52 53 54 55 56 57 58 59 | |
logs
abstractmethod
logs(output_dir: Union[str, Path], *args, **kwargs)
Retrieve logs from all managed containers and save them to the specified directory.
Parameters:
Examples:
>>> runtime.logs("/tmp/container_logs")
Source code in ures/docker/runtime.py
61 62 63 64 65 66 67 68 69 70 71 72 | |
SimpleRuntime
SimpleRuntime(containers: List[Container], interval: float = 0.5)
Bases: Runtime
Source code in ures/docker/runtime.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
run
run(*args, **kwargs)
Runs each container by calling its run() method. If the container becomes running, wait() is called; otherwise, an error is logged.
Examples:
>>> runtime = SimpleRuntime([container1, container2])
>>> runtime.run()
Source code in ures/docker/runtime.py
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
stop
stop(*args, **kwargs)
Stops each container by calling its stop() method.
Examples:
>>> runtime.stop()
Source code in ures/docker/runtime.py
94 95 96 97 98 99 100 101 102 103 | |
remove
remove(*args, **kwargs)
Removes each container by calling its remove() method.
Examples:
>>> runtime.remove()
Source code in ures/docker/runtime.py
105 106 107 108 109 110 111 112 113 114 | |
logs
logs(output_dir: Union[str, Path], *args, **kwargs)
Retrieves logs from each container and writes them to a "logs.txt" file in a directory named after the container's image (with ":" replaced by "-").
Parameters:
Examples:
>>> runtime.logs("/tmp/container_logs")
Source code in ures/docker/runtime.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |