koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 1 | from typing import List, Callable, Any, Dict, Optional, Set |
koder aka kdanilov | 22d134e | 2016-11-08 11:33:19 +0200 | [diff] [blame] | 2 | from concurrent.futures import ThreadPoolExecutor |
| 3 | |
| 4 | |
| 5 | from .timeseries import SensorDatastore |
koder aka kdanilov | 7308462 | 2016-11-16 21:51:08 +0200 | [diff] [blame] | 6 | from .node_interfaces import NodeInfo, IRPCNode |
koder aka kdanilov | 39e449e | 2016-12-17 15:15:26 +0200 | [diff] [blame] | 7 | from .openstack_api import OSCreds, OSConnection |
koder aka kdanilov | 3d2bc4f | 2016-11-12 18:31:18 +0200 | [diff] [blame] | 8 | from .storage import Storage |
koder aka kdanilov | 22d134e | 2016-11-08 11:33:19 +0200 | [diff] [blame] | 9 | from .config import Config |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 10 | from .fuel_rest_api import Connection |
koder aka kdanilov | 22d134e | 2016-11-08 11:33:19 +0200 | [diff] [blame] | 11 | |
| 12 | |
koder aka kdanilov | 3b4da8b | 2016-10-17 00:17:53 +0300 | [diff] [blame] | 13 | class TestRun: |
| 14 | """Test run information""" |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 15 | def __init__(self, config: Config, storage: Storage) -> None: |
koder aka kdanilov | 3b4da8b | 2016-10-17 00:17:53 +0300 | [diff] [blame] | 16 | # NodesInfo list |
koder aka kdanilov | 3d2bc4f | 2016-11-12 18:31:18 +0200 | [diff] [blame] | 17 | self.nodes_info = [] # type: List[NodeInfo] |
koder aka kdanilov | 3b4da8b | 2016-10-17 00:17:53 +0300 | [diff] [blame] | 18 | |
| 19 | # Nodes list |
koder aka kdanilov | 3d2bc4f | 2016-11-12 18:31:18 +0200 | [diff] [blame] | 20 | self.nodes = [] # type: List[IRPCNode] |
koder aka kdanilov | 3b4da8b | 2016-10-17 00:17:53 +0300 | [diff] [blame] | 21 | |
koder aka kdanilov | 22d134e | 2016-11-08 11:33:19 +0200 | [diff] [blame] | 22 | self.build_meta = {} # type: Dict[str,Any] |
| 23 | self.clear_calls_stack = [] # type: List[Callable[['TestRun'], None]] |
koder aka kdanilov | 3b4da8b | 2016-10-17 00:17:53 +0300 | [diff] [blame] | 24 | |
| 25 | # openstack credentials |
koder aka kdanilov | 22d134e | 2016-11-08 11:33:19 +0200 | [diff] [blame] | 26 | self.fuel_openstack_creds = None # type: Optional[OSCreds] |
koder aka kdanilov | 39e449e | 2016-12-17 15:15:26 +0200 | [diff] [blame] | 27 | self.fuel_version = None # type: Optional[List[int]] |
koder aka kdanilov | 3d2bc4f | 2016-11-12 18:31:18 +0200 | [diff] [blame] | 28 | self.os_creds = None # type: Optional[OSCreds] |
koder aka kdanilov | 7308462 | 2016-11-16 21:51:08 +0200 | [diff] [blame] | 29 | self.os_connection = None # type: Optional[OSConnection] |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 30 | self.fuel_conn = None # type: Optional[Connection] |
| 31 | self.rpc_code = None # type: bytes |
koder aka kdanilov | e7e1a4d | 2016-12-17 20:29:52 +0200 | [diff] [blame^] | 32 | self.default_rpc_plugins = None # type: Dict[str, bytes] |
koder aka kdanilov | 3b4da8b | 2016-10-17 00:17:53 +0300 | [diff] [blame] | 33 | |
koder aka kdanilov | 22d134e | 2016-11-08 11:33:19 +0200 | [diff] [blame] | 34 | self.storage = storage |
| 35 | self.config = config |
| 36 | self.sensors_data = SensorDatastore() |
koder aka kdanilov | 7022706 | 2016-11-26 23:23:21 +0200 | [diff] [blame] | 37 | self.sensors_run_on = set() # type: Set[str] |
koder aka kdanilov | 39e449e | 2016-12-17 15:15:26 +0200 | [diff] [blame] | 38 | self.os_spawned_nodes_ids = None # type: List[int] |
koder aka kdanilov | 22d134e | 2016-11-08 11:33:19 +0200 | [diff] [blame] | 39 | |
| 40 | def get_pool(self): |
| 41 | return ThreadPoolExecutor(self.config.get('worker_pool_sz', 32)) |
koder aka kdanilov | 3b4da8b | 2016-10-17 00:17:53 +0300 | [diff] [blame] | 42 | |