Select to view content in your preferred language

Publishing GP service via script fails to create Tasks

315
0
03-15-2024 02:29 PM
FredSpataro
Occasional Contributor III

Hi All, 

This process was working correctly just recently, only change has been the latest ArcPro update.  I'm basically following the examples in this help doc.  Sample of bare min code to reproduce below. 

My service/task list is pretty complicated so the script is a HUGE time/mistake saver. 

I've tried a few tweaks and modified it down to just one tool and always get the same result.  I've also tried the script with just a single, simple out-of-the box tool (AddXY) rather than the custom tools/scripts -- example below. 

Environment:

  • ArcPro 3.2.2
  • ArcGIS Server (standalone 11.1)

Process Results:

  • sddraft and sd files get created (no warnings, errors in analyze)
    • I've opened the sd archive and extracted.  Everything looks fine.  The toolbox contains tools to be  published as tasks as configured
  • sd file uploads fine to arcgis server
  • service creates without error
  • no arcgis server manager log errors or warnings nor obvious messages at info level 
  • Two issues:
    • service task list is empty!
    • minor but the message level setting does not take.  SOC count and other service properties get set correctly.    

Repro script:

 

 

result = arcpy.management.AddXY(
    in_features=r"D:\temp\data\scratch\Default.gdb\GPXPoints"
)                                   ^
sd = r"D:\temp\data\scratch\xy.sd"
sddraft = r"D:\temp\data\scratch\xy.sddraft"
serverconnectionfile = r"D:\temp\data\scratch\arcgis_on_server.com.ags"
serviceName = "XYTest"
analyzeMessages = arcpy.CreateGPSDDraft(
    result, sddraft, serviceName, server_type="FROM_CONNECTION_FILE",  
    connection_file_path= serverconnectionfile,
    copy_data_to_server=True, folder_name=None, 
    summary="XY Service", tags="gp", executionType="Synchronous",
    resultMapServer=False, showMessages="INFO", maximumRecords=5000,
    minInstances=2, maxInstances=3, maxUsageTime=100, maxWaitTime=10,
    maxIdleTime=180)
analyzeMessages
#{'errors': {}, 'warnings': {}, 'messages': {}}
arcpy.server.StageService(sddraft, sd)
#<Result 'D:\\temp\\data\\scratch\\xy.sd'>

 

 

Attached are the output sddraft and sd files

Thanks for any insights.

 

0 Kudos
0 Replies