Normalize user provided arguments to blockwise or map_blocks We do a few things: 1. If they are string literals that might collide with blockwise_token then we quote them 2. IF they are large (as defined by sizeof) then we put them into the graph on their own by using
(x)
| 516 | |
| 517 | |
| 518 | def normalize_arg(x): |
| 519 | """Normalize user provided arguments to blockwise or map_blocks |
| 520 | |
| 521 | We do a few things: |
| 522 | |
| 523 | 1. If they are string literals that might collide with blockwise_token then we |
| 524 | quote them |
| 525 | 2. IF they are large (as defined by sizeof) then we put them into the |
| 526 | graph on their own by using dask.delayed |
| 527 | """ |
| 528 | if is_dask_collection(x): |
| 529 | return x |
| 530 | elif isinstance(x, str) and re.match(r"_\d+", x): |
| 531 | return delayed(x) |
| 532 | elif isinstance(x, list) and len(x) >= 10: |
| 533 | return delayed(x) |
| 534 | elif sizeof(x) > 1e6: |
| 535 | return delayed(x) |
| 536 | else: |
| 537 | return x |
| 538 | |
| 539 | |
| 540 | def _pass_extra_kwargs(func, keys, *args, **kwargs): |
no test coverage detected
searching dependent graphs…