Skip to content

Commit e207701

Browse files
committed
monkey patch to serialize specifications object
1 parent 4453267 commit e207701

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

ogcore/SS.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,27 @@ def inner_loop(outer_loop_vars, p, client):
283283
# from dask.base import dask_sizeof
284284

285285
if client:
286-
# Scatter p only once and only if client not equal None
286+
287+
# Before scattering, temporarily remove unpicklable schema objects
288+
schema_backup = {}
289+
for attr in ['_defaults_schema', '_validator_schema', 'sel']:
290+
if hasattr(p, attr):
291+
schema_backup[attr] = getattr(p, attr)
292+
try:
293+
delattr(p, attr)
294+
except:
295+
pass
296+
297+
# Scatter the parameters
287298
scattered_p_future = client.scatter(p, broadcast=True)
288299

300+
# Restore the schema objects (they're not needed by workers anyway)
301+
for attr, value in schema_backup.items():
302+
try:
303+
setattr(p, attr, value)
304+
except:
305+
pass
306+
289307
# Launch in parallel with submit (or map)
290308
futures = []
291309
for j in range(p.J):

0 commit comments

Comments
 (0)