Do module abspath loading in actor init
							parent
							
								
									afa640dcab
								
							
						
					
					
						commit
						91c3716968
					
				|  | @ -10,7 +10,6 @@ import inspect | ||||||
| import uuid | import uuid | ||||||
| import typing | import typing | ||||||
| from typing import Dict, List, Tuple, Any, Optional | from typing import Dict, List, Tuple, Any, Optional | ||||||
| from types import ModuleType |  | ||||||
| import sys | import sys | ||||||
| import os | import os | ||||||
| 
 | 
 | ||||||
|  | @ -169,7 +168,7 @@ class Actor: | ||||||
|     def __init__( |     def __init__( | ||||||
|         self, |         self, | ||||||
|         name: str, |         name: str, | ||||||
|         rpc_module_paths: Dict[str, ModuleType] = {}, |         rpc_module_paths: List[str] = {}, | ||||||
|         statespace: Optional[Dict[str, Any]] = None, |         statespace: Optional[Dict[str, Any]] = None, | ||||||
|         uid: str = None, |         uid: str = None, | ||||||
|         loglevel: str = None, |         loglevel: str = None, | ||||||
|  | @ -177,7 +176,13 @@ class Actor: | ||||||
|     ) -> None: |     ) -> None: | ||||||
|         self.name = name |         self.name = name | ||||||
|         self.uid = (name, uid or str(uuid.uuid4())) |         self.uid = (name, uid or str(uuid.uuid4())) | ||||||
|         self.rpc_module_paths = rpc_module_paths | 
 | ||||||
|  |         mods = {} | ||||||
|  |         for path in rpc_module_paths or (): | ||||||
|  |             mod = importlib.import_module(path) | ||||||
|  |             mods[path] = mod.__file__ | ||||||
|  | 
 | ||||||
|  |         self.rpc_module_paths = mods | ||||||
|         self._mods: dict = {} |         self._mods: dict = {} | ||||||
| 
 | 
 | ||||||
|         # TODO: consider making this a dynamically defined |         # TODO: consider making this a dynamically defined | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue