Function Wrapper for Lazy Importing. This Class should only be used when materializing a graph on a distributed scheduler.
| 27 | |
| 28 | |
| 29 | class CallableLazyImport: |
| 30 | """Function Wrapper for Lazy Importing. |
| 31 | |
| 32 | This Class should only be used when materializing a graph |
| 33 | on a distributed scheduler. |
| 34 | """ |
| 35 | |
| 36 | def __init__(self, function_path): |
| 37 | self.function_path = function_path |
| 38 | |
| 39 | def __call__(self, *args, **kwargs): |
| 40 | from distributed.utils import import_term |
| 41 | |
| 42 | return import_term(self.function_path)(*args, **kwargs) |
| 43 | |
| 44 | |
| 45 | # |