# Name: PublishWorkflowService_sample.py
# Description: The following script Uploads and shares a workflow service and a map
# service of job locations for an ArcGIS Workflow Manager (Classic) repository using a
# connection to an ArcGIS Server with the Workflow Manager (Classic) Server extension.
# Import system modules
import arcpy
# Check out extensions
arcpy.CheckOutExtension('jtx')
# Set local variables
service_name = 'Example Workflow Service'
aoi_service_name = 'Example Map Service'
server = 'myServerConnection.ags'
out_service_draft_location = r'C:\Project\DraftOutput'
input_database_path = r'C:\Project\wmxrepository.jtc'
server_folder = 'My Folder'
description = 'My Description'
# Call the PublishWorkflowService tool to upload and share a workflow service and a
# map service of job locations for the specified Workflow Manager (Classic) repository.
arcpy.wmx.PublishWorkflowService(service_name, aoi_service_name, server,\
out_service_draft_location, input_database_path,\
server_folder, description)
# Get all messages, warnings, and errors and print the results
messages = arcpy.GetMessages(0)
warnings = arcpy.GetMessages(1)
errors = arcpy.GetMessages(2)
arcpy.AddMessage('Tool Messages: {}\nTool Warnings: {}\nTool Errors{}\n'\
.format(messages, warnings, errors))
# Check in extensions
arcpy.CheckInExtension('jtx')