The estimate credit requirement that has been added in 3.1.x is preventing my scripts from running since it requires the user to manually click the button in the geoprocessing pane.
Can we get this functionality in arcpy. I really like the ability to estimate credits, but I would like the ability to allow bypass for certain users or to auto accept if under a certain threshold.
For example: I run a weekly change detection script to update attributes which includes geocoding new/changed addresses. The number of addresses varies from 0-30 on a weekly basis with an average of ~5. I currently have to manually run the geocode script in the middle of my script. I would like the ability to bypass and/or auto accept the estimated credits if under 40 (would be for the 40 credits/1000 addresses). This would allow my script to run smoothly, but still throw an error if the source table somehow gets too many records added.
Hi Eric,
What is preventing your scripts from running? Unless I'm misunderstanding, running the tools from python already serves as a way to "bypass" the credit estimation requirement.
We currently don't offer a way to estimate credit usage for custom scripts. It is pretty complicated to account for custom python logic that would change the credit spend. But you could add logic to your script to stop the tool from running based on the number of features involved.
def updateMessages(self):
self.params[0].clearMessage()
# get the count of the in_features
feature_count = int(arcpy.management.GetCount(self.params[0].value).getOutput(0))
# do some math
# 10 credits per 1,000 attributes (data variables multiplied by total feature records)
# only one data variable is being used in this example
# https://doc.arcgis.com/en/arcgis-online/analyze/credits-analysis-mv.htm
enrich_cost = 10/1000*feature_count
# compare the results
if enrich_cost > 0.02:
self.params[0].setErrorMessage(f"hey, easy big spender... that'll cost us {enrich_cost} credits" )
else:
self.params[0].setWarningMessage(f"alright fine go ahead, spend {enrich_cost} credits" )
return
this kind of validation stops the tool from running (or allows it to run) like this:
Hi Danny,
My current change detection script that I run in a notebook now fails at the geocode step (arcpy.geocoding.GeocodeAddresses) after updating to 3.1.1.
When I open the failed tool from the geoprocessing history and try to run it manually I get the following error:
Once I click the estimate credits link at the top of the Geocode Addresses tool in the geoprocessing pane I am able to run the tool then proceed with the script.
That message should only appear in the geoprocessing pane. What error is your notebook failing with?
I have a better explanation of the error in a cross post in ArcGIS Pro Questions:
I am getting the Error 000005: Could not open the address locator. When I open the failed tool in the geoprocessing history I only have to click the estimate credits link for the tool to run.
I am returning this idea back to an open state.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.