diff --git a/daskms/parallel_table.py b/daskms/parallel_table.py index bef97a39..d1580afd 100644 --- a/daskms/parallel_table.py +++ b/daskms/parallel_table.py @@ -8,6 +8,11 @@ log = logging.getLogger(__name__) +def _map_create_parallel_table(cls, args, kwargs): + """ Support pickling of kwargs in ParallelTable.__reduce__ """ + return cls(*args, **kwargs) + + def _parallel_table_finalizer(_linked_tables): for table in _linked_tables.values(): @@ -31,6 +36,13 @@ def __init__(self, *args, **kwargs): finalize(self, _parallel_table_finalizer, self._linked_tables) + def __reduce__(self): + """ Defer to _map_create_parallel_table to support kwarg pickling """ + return ( + _map_create_parallel_table, + (ParallelTable, self._args, self._kwargs) + ) + def getcol(self, *args, **kwargs): table = self._get_table(threading.get_ident()) return table.getcol(*args, **kwargs)