Select to view content in your preferred language

AnalyzeToolsForPro runs slow when run from ArcGIS Pro toolbox vs standalone python script

324
1
Jump to solution
10-24-2024 03:32 PM
DonMorrison1
Frequent Contributor

I have a Argis Pro 3.3.2 Python toolbox tool that I use to publish a set of geoprocessing tasks to our 11.3 ArcGIS server. In the process of trying to debug a problem with the staging request added a call to arcpy.management.AnalyzeToolsForPro to see if it would help with the debugging (it didn't).  When I ran it from the toobox, it took almost and hour to complete for each of the 2 tasks.  When I run the exact same script standalone it takes about 2 minutes for each.  What could explain this?  In case it matters I'm running the toolbox in an essentially empty project. 

The other, perhaps more important mystery, is why the call to StageService_server works in the standalone script but fails when run in the toobox. You can see the results coming back from the CreateGPSDDraft call are different for some reason.

Here is my trace from the standalone script 

2024-10-24 13:20:28,850 - INFO - service_definition_gp - DEVOrgA: Analyzer output: E:/ROW_as_Habitat/sd_drafts\GeoImport_analyzer.txt
2024-10-24 13:22:32,991 - INFO - service_definition_gp - DEVOrgA: Running tool BeeAnalysis
2024-10-24 13:22:33,418 - INFO - service_definition_gp - DEVOrgA: Analyzer output: E:/ROW_as_Habitat/sd_drafts\BeeAnalysis_analyzer.txt
2024-10-24 13:24:42,385 - INFO - service_definition_gp - DEVOrgA: Creating SDDraft DEVOrgA_GpTools
2024-10-24 13:24:58,221 - INFO - service_definition_gp - DEVOrgA: CreateGPSDDraft Results {'errors': {}, 'warnings': {('Data source used by Script BeeAnalysis is not registered with the server and will be copied to the server: C:\\Git_Repository\\ROW_as_habitat\\row\\consolidation', 24032): [None], ('Data source used by Script BeeAnalysis is not registered with the server and will be copied to the server: C:\\Git_Repository\\ROW_as_habitat\\row\\toolbox\\published\\clean_and_validate_report.html', 24032): [None], ('Data source used by Script BeeAnalysis is not registered with the server and will be copied to the server: C:\\Git_Repository\\ROW_as_habitat\\row\\toolbox\\published\\geo_import_report.html', 24032): [None], ('Data source used by Script BeeAnalysis is not registered with the server and will be copied to the server: C:\\Git_Repository\\ROW_as_habitat\\row\\toolbox\\published\\Bee Habitat Report Template.rptx', 24032): [None], ('Data source used by Script GeoImport is not registered with the server and will be copied to the server: C:\\Git_Repository\\ROW_as_habitat\\row\\consolidation', 24032): [None], ('Data source used by Script GeoImport is not registered with the server and will be copied to the server: C:\\Git_Repository\\ROW_as_habitat\\row\\toolbox\\published\\clean_and_validate_report.html', 24032): [None], ('Data source used by Script GeoImport is not registered with the server and will be copied to the server: C:\\Git_Repository\\ROW_as_habitat\\row\\toolbox\\published\\geo_import_report.html', 24032): [None], ('Data source used by Script GeoImport is not registered with the server and will be copied to the server: C:\\Git_Repository\\ROW_as_habitat\\row\\toolbox\\published\\Bee Habitat Report Template.rptx', 24032): [None]}, 'messages': {}}
2024-10-24 13:24:58,222 - INFO - service_definition_gp - DEVOrgA: Creating SD DEVOrgA_GpTools
2024-10-24 13:25:57,971 - INFO - service_definition_gp - DEVOrgA: Uploading SD DEVOrgA_GpTools

 

Here is my trace when run from the toolbox in ArcGIS Pro

2024-10-24 14:45:28,025 - INFO - service_definition_gp - DEVOrgA: Analyzer output: E:/ROW_as_Habitat/sd_drafts\GeoImport_analyzer.txt
2024-10-24 15:36:07,186 - INFO - service_definition_gp - DEVOrgA: Running tool BeeAnalysis
2024-10-24 15:36:07,652 - INFO - service_definition_gp - DEVOrgA: Analyzer output: E:/ROW_as_Habitat/sd_drafts\BeeAnalysis_analyzer.txt
2024-10-24 16:25:11,704 - INFO - service_definition_gp - DEVOrgA: Creating SDDraft DEVOrgA_GpTools
2024-10-24 16:27:32,304 - INFO - service_definition_gp - DEVOrgA: CreateGPSDDraft Results {'errors': {('ERROR 001238: Script BeeAnalysis contains broken project data source: org_view', 68): [None], ('ERROR 001238: Script BeeAnalysis contains broken project data source: fqn', 68): [None], ('ERROR 001238: Script BeeAnalysis contains broken project data source: PollinatorScorecard', 68): [None], ('ERROR 001238: Script BeeAnalysis contains broken project data source: ManagementArea', 68): [None], ('ERROR 001238: Script GeoImport contains broken project data source: org_view', 68): [None], ('ERROR 001238: Script GeoImport contains broken project data source: fqn', 68): [None], ('ERROR 001238: Script GeoImport contains broken project data source: PollinatorScorecard', 68): [None], ('ERROR 001238: Script GeoImport contains broken project data source: ManagementArea', 68): [None]}, 'warnings': {('Data source used by Script BeeAnalysis is not registered with the server and will be copied to the server: C:\\Git_Repository\\ROW_as_habitat\\row\\consolidation', 24032): [None], ('Data source used by Script BeeAnalysis is not registered with the server and will be copied to the server: org_view', 24032): [None], ('Data source used by Script BeeAnalysis is not registered with the server and will be copied to the server: fqn', 24032): [None], ('Data source used by Script BeeAnalysis is not registered with the server and will be copied to the server: PollinatorScorecard', 24032): [None], ('Data source used by Script BeeAnalysis is not registered with the server and will be copied to the server: ManagementArea', 24032): [None], ('Data source used by Script BeeAnalysis is not registered with the server and will be copied to the server: C:\\Git_Repository\\ROW_as_habitat\\row\\toolbox\\published\\clean_and_validate_report.html', 24032): [None], ('Data source used by Script BeeAnalysis is not registered with the server and will be copied to the server: C:\\Git_Repository\\ROW_as_habitat\\row\\toolbox\\published\\geo_import_report.html', 24032): [None], ('Data source used by Script BeeAnalysis is not registered with the server and will be copied to the server: C:\\Git_Repository\\ROW_as_habitat\\row\\toolbox\\published\\Bee Habitat Report Template.rptx', 24032): [None], ('Data source used by Script GeoImport is not registered with the server and will be copied to the server: C:\\Git_Repository\\ROW_as_habitat\\row\\consolidation', 24032): [None], ('Data source used by Script GeoImport is not registered with the server and will be copied to the server: org_view', 24032): [None], ('Data source used by Script GeoImport is not registered with the server and will be copied to the server: fqn', 24032): [None], ('Data source used by Script GeoImport is not registered with the server and will be copied to the server: PollinatorScorecard', 24032): [None], ('Data source used by Script GeoImport is not registered with the server and will be copied to the server: ManagementArea', 24032): [None], ('Data source used by Script GeoImport is not registered with the server and will be copied to the server: C:\\Git_Repository\\ROW_as_habitat\\row\\toolbox\\published\\clean_and_validate_report.html', 24032): [None], ('Data source used by Script GeoImport is not registered with the server and will be copied to the server: C:\\Git_Repository\\ROW_as_habitat\\row\\toolbox\\published\\geo_import_report.html', 24032): [None], ('Data source used by Script GeoImport is not registered with the server and will be copied to the server: C:\\Git_Repository\\ROW_as_habitat\\row\\toolbox\\published\\Bee Habitat Report Template.rptx', 24032): [None]}, 'messages': {}}
2024-10-24 16:27:32,305 - DEBUG - service_definition_gp - DEVOrgA: CreateGPSDDraft Errors {('ERROR 001238: Script BeeAnalysis contains broken project data source: org_view', 68): [None], ('ERROR 001238: Script BeeAnalysis contains broken project data source: fqn', 68): [None], ('ERROR 001238: Script BeeAnalysis contains broken project data source: PollinatorScorecard', 68): [None], ('ERROR 001238: Script BeeAnalysis contains broken project data source: ManagementArea', 68): [None], ('ERROR 001238: Script GeoImport contains broken project data source: org_view', 68): [None], ('ERROR 001238: Script GeoImport contains broken project data source: fqn', 68): [None], ('ERROR 001238: Script GeoImport contains broken project data source: PollinatorScorecard', 68): [None], ('ERROR 001238: Script GeoImport contains broken project data source: ManagementArea', 68): [None]}
2024-10-24 16:27:32,305 - INFO - service_definition_gp - DEVOrgA: Creating SD DEVOrgA_GpTools
2024-10-24 16:29:48,591 - ERROR - controller - DEVOrgA: ERROR 001272: Analyzer errors were encountered ([{"code":"00068","message":"Script BeeAnalysis contains broken project data source: org_view","object":"C:\\Users\\DMORRI~1\\AppData\\Local\\Temp\\ArcGISProTemp14340\\E486093E19C046E7B11A9A25973CAB2B.tbx\\BeeAnalysis"},{"code":"00068","message":"Script BeeAnalysis contains broken project data source: fqn","object":"C:\\Users\\DMORRI~1\\AppData\\Local\\Temp\\ArcGISProTemp14340\\E486093E19C046E7B11A9A25973CAB2B.tbx\\BeeAnalysis"},{"code":"00068","message":"Script BeeAnalysis contains broken project data source: PollinatorScorecard","object":"C:\\Users\\DMORRI~1\\AppData\\Local\\Temp\\ArcGISProTemp14340\\E486093E19C046E7B11A9A25973CAB2B.tbx\\BeeAnalysis"},{"code":"00068","message":"Script BeeAnalysis contains broken project data source: ManagementArea","object":"C:\\Users\\DMORRI~1\\AppData\\Local\\Temp\\ArcGISProTemp14340\\E486093E19C046E7B11A9A25973CAB2B.tbx\\BeeAnalysis"},{"code":"00068","message":"Script GeoImport contains broken project data source: org_view","object":"C:\\Users\\DMORRI~1\\AppData\\Local\\Temp\\ArcGISProTemp14340\\E486093E19C046E7B11A9A25973CAB2B.tbx\\GeoImport"},{"code":"00068","message":"Script GeoImport contains broken project data source: fqn","object":"C:\\Users\\DMORRI~1\\AppData\\Local\\Temp\\ArcGISProTemp14340\\E486093E19C046E7B11A9A25973CAB2B.tbx\\GeoImport"},{"code":"00068","message":"Script GeoImport contains broken project data source: PollinatorScorecard","object":"C:\\Users\\DMORRI~1\\AppData\\Local\\Temp\\ArcGISProTemp14340\\E486093E19C046E7B11A9A25973CAB2B.tbx\\GeoImport"},{"code":"00068","message":"Script GeoImport contains broken project data source: ManagementArea","object":"C:\\Users\\DMORRI~1\\AppData\\Local\\Temp\\ArcGISProTemp14340\\E486093E19C046E7B11A9A25973CAB2B.tbx\\GeoImport"}]).
Failed to execute (StageService).

 

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
DonMorrison1
Frequent Contributor

I turned on the ArcGIS Pro diagnostic monitor (ctl atl m) to see what was happening during the publish from ArcGIS pro and it appears the code was spinning on repeatedly (millions of times) opening database files and maps that just happened to be in my project. Those maps and database connections were not relevant to the publish so I removed them from the project and it made a huge difference. The analyzer finished in about 2 minutes so I think that explains the difference. When I run the publish from a standalone script there is no project involved.  

View solution in original post

0 Kudos
1 Reply
DonMorrison1
Frequent Contributor

I turned on the ArcGIS Pro diagnostic monitor (ctl atl m) to see what was happening during the publish from ArcGIS pro and it appears the code was spinning on repeatedly (millions of times) opening database files and maps that just happened to be in my project. Those maps and database connections were not relevant to the publish so I removed them from the project and it made a huge difference. The analyzer finished in about 2 minutes so I think that explains the difference. When I run the publish from a standalone script there is no project involved.  

0 Kudos