Let’s say I need to create ten expense models that are all unique to a specific well.
Currently, doing something like this:
expense_model_list = [model1, model2, ...]
endpoint = "HTTPS://create_expense_model_endpoint"
for model in expense_model_list:
create_model(endpoint, model)
This works, but it’s pretty slow since I’m making a single request per unique model in the list.
I’m curious if there’s a way I can “batch” these econ model creations like so:
expense_model_list = [model1, model2, model3]
batch = prepare_batch(expense_model_list)
endpoint = "HTTPS://create_expense_model_endpoint"
create_model(endpoint, batch)
This way, I’d only be pinging the endpoint with a single POST request per batch hopefully speeding up the process.
Thanks!
Hey Travis,
You can send in an array of Expense models (up to 500) via the Expense POST Endpoint.
Example:
[
{
“name”: “Expense Scenario A”,
“unique”: true,
“scenario”: “SCN-001”,
“well”: “WELL-123”,
“variableExpenses”: {
“fuel”: 15000,
“chemicals”: 5000
},
“fixedExpenses”: {
“lease”: 20000,
“insurance”: 3000
},
“waterDisposal”: {
“injection”: 4000
},
“carbonExpenses”: {
“credits”: 1200
}
},
{
“name”: “Expense Scenario B”,
“unique”: false,
“scenario”: “SCN-002”,
“well”: “WELL-456”,
“variableExpenses”: {
“fuel”: 12000,
“chemicals”: 4500
},
“fixedExpenses”: {
“lease”: 18000,
“insurance”: 2800
},
“waterDisposal”: {
“injection”: 3500
},
“carbonExpenses”: {
“credits”: 900
}
}
]
Thanks Danny, I was able to implement this approach and it sped up my code a bunch. Appreciate the help.