Move batch client instantiation inside functions
Move batch client instantiation inside functions

When this code is outside a function call it ends up being run by the
scheduler, workers, and webserver when it does not need to be. This can
create some odd behavior or seemingly harmless errors -- the solution is
to move it inside function calls, which themselves do not get called all
that often or in a tight loop so I think the performance penalty here
should be nil, if any.

aaronxsu/raster-foundry,aaronxsu/raster-foundry,azavea/raster-foundry,azavea/raster-foundry,aaronxsu/raster-foundry,azavea/raster-foundry,raster-foundry/raster-foundry,aaronxsu/raster-foundry,raster-foundry/raster-foundry,azavea/raster-foundry,azavea/raster-foundry,raster-foundry/raster-foundry