Skip to main content

Batch mode

For multiple calculation calls ArupCompute works best with batch requests.

It is also generally best to use resultType="mini". This stops the reports being generated, saving computation time as well as the time needed to transmit these (often large) documents over the network.

import arupcomputepy

jobNumber = '00000000' # for testing only - please use a real job number
connection = arupcomputepy.Connection(jobNumber)

calcID = 2081643 # Sample Library v2.1.60 Examples.BasicUse > Basic Calc

# Note that we use lists of input data for a batch calculation
variables = {
'a': [1,20,300,4000,500,60],
'b': [2,40,600,7000,800,90]
}

# Note that we need to set the variable isBatch = True
response = arupcomputepy.MakeCalculationRequest(connection, calcID, isBatch=True, variables=variables)

for item in response:
print(item)

Parallel Mode

When making calls to AC Local you can use "parallel mode" to run a batch of calcs. This will make AC Local run the calculations in the batch in parallel, meaning that the batch will run faster. There is additional setup time required on AC Local when running calcs in parallel, so for small batches it is better to run the batch not in parallel mode. From testing we have found that if the batch is larger than 10 calcs then running in parallel will be faster than in regular batch mode.

To run a calc in parallel, set the parallel param in MakeCalculationRequest to True.

import arupcomputepy

jobNumber = '00000000' # for testing only - please use a real job number
connection = arupcomputepy.Connection(jobNumber)

calcID = 2081643 # Sample Library v2.1.60 Examples.BasicUse > Basic Calc

# Note that we use lists of input data for a batch calculation
variables = {
'a': [1,20,300,4000,500,60],
'b': [2,40,600,7000,800,90]
}

# Note that we need to set the variable isBatch = True and parallel = True
response = arupcomputepy.MakeCalculationRequest(connection, calcID, isBatch=True, parallel=True, variables=variables)

for item in response:
print(item)
useFanOut

parallel should not be set to True at the same time as useFanOut. Doing this would mean that parallel would have no effect