handle some spark serialization issues

1.  itertools.tee doesn't serialize well
2.  pre-resolve the dispatched compute function