Something I’m running into that is a bit frustrating for my use case is that when batching calls a single failure kills the entire batch.
So when I’m making a series of batched Compute calls an unexpected result in an early batch call might mean a ‘None’ in the input array to the next batch call, witch kills the entire process, instead of ‘None’ values just propagating through the batch calls to the next call.
Is this by design? Is this necessary? Are there any plans to change this?
Most importantly, does anyone have any suggestions to deal with/work around it in Compute’s current state?
Batch calls are critical for speed with Compute, but batch calls that fail due to a single ‘None’ among the inputs are very, very painful to deal with in a large system.
Here’s some example code to demonstrate what I’m talking about:
import rhino3dm
import compute_rhino3d.Brep as Brep
import compute_rhino3d.AreaMassProperties as AMP
c1 = rhino3dm.Point3d(0,0,0)
c2 = rhino3dm.Point3d(1000,0,0)
c3 = rhino3dm.Point3d(1000,1000,0)
c4 = rhino3dm.Point3d(0,1000,0)
surf = Brep.CreateFromCornerPoints1( c1, c2, c3, c4, 1 )
surf_arr = [surf]*30
boolParams = [True]*30
result = AMP.Compute6( surf_arr, boolParams, boolParams, boolParams, boolParams, multiple=True )
print( len(result), type(result) )
#no None in input, so no problem
#output: 30 <class 'list'>
surf_arr = [surf]*29 + [None]
result = AMP.Compute6( surf_arr, boolParams, boolParams, boolParams, boolParams, multiple=True )
print( len(result), type(result) )
#one None in the input array, so no results, entire batch call fails
#output: 3 <class 'dict'>
print(result)
#output: {'statusCode': 500, 'message': 'Something went horribly, horribly wrong while servicing your request.', 'details': 'Nancy.RequestExecutionException: Oh noes! ---> //snip