Resumen
The function converts Result objects and result files (.rlt) into Service Definition Draft (.sddraft) files.
Debate
CreateGPSDDraft is the first step to automating the publishing of a geoprocessing result to a GIS Server using ArcPy. The output created from the CreateGPSDDraft is a Service Definition Draft (.sddraft) file. A Service Definition Draft is the combination of a result file or Result object, information about the server, and a set of service properties. A Result object can be created in a Python script by setting a variable to a tool execution, for example, the following buffer result gets saved to a variable called result.
import arcpy
result = arcpy.Buffer_analysis("inPts", "output.shp", "100 Meters")
Information about the server includes the server connection, server type being published to, the type of service being published, metadata for the service (Item info), and data references (whether or not data is being copied to the server).
The function returns a Python dictionary containing errors and other potential issues that you should address prior to creating your Service Definition file.
Sintaxis
CreateGPSDDraft (result, out_sddraft, service_name, {server_type}, {connection_file_path}, {copy_data_to_server}, {folder_name}, {summary}, {tags}, {executionType}, {resultMapServer}, {showMessages}, {maximumRecords}, {minInstances}, {maxInstances}, {maxUsageTime}, {maxWaitTime}, {maxIdleTime})
Parámetro | Explicación | Tipo de datos |
result [result,...] | A reference to one or multiple Result objects or result files (.rlt) on disk. Multiple results must be supplied in a list format. The following example demonstrates multiple results as input to the CreateGPSDDraft function.
| Result |
out_sddraft | A string that represents the path and file name for the output Service Definition Draft (.sddraft) file. | String |
service_name | A string that represents the name of the service. This is the name people will see and use to identify the service. The name can only contain alphanumeric characters and underscores. No spaces or special characters are allowed. The name cannot be more than 120 characters in length. | String |
server_type | A string representing the server type. If a connection_file_path parameter is not supplied, then a server_type must be provided. If a connection_file_path parameter is supplied, then the server_type is taken from the connection file. In this case, you can choose FROM_CONNECTION_FILE or skip the parameter entirely.
(El valor predeterminado es ARCGIS_SERVER) | String |
connection_file_path | A string that represents the path and file name to the ArcGIS for Server connection file (.ags). | String |
copy_data_to_server | A Boolean that indicates whether the data referenced in the result will be copied to the server or not. The copy_data_to_server parameter is only used if the server_type is ARCGIS_SERVER and the connection_file_path isn't specified. If the connection_file_path is specified, then the server's registered data stores are used. For example, if the data in the result is registered with the server, then copy_data_to_server will always be False. Conversely, if the data in the result is not registered with the server, then copy_data_to_server will always be True. (El valor predeterminado es False) | Boolean |
folder_name | A string that represents a folder name to which you want to publish the service definition. If the folder does not currently exist, it will be created. The default folder is the server root level. (El valor predeterminado es None) | String |
summary | A string that represents the Item Description Summary. Use this parameter to override the user interface summary, or to provide a summary if one does not exist. The summary provided here will not be persisted in the map document. (El valor predeterminado es None) | String |
tags | A string that represents the Item Description Tags. Use this parameter to override the user interface tags, or to provide tags if they do not exist. The tags provided here will not be persisted in the map document. (El valor predeterminado es None) | String |
executionType | Sincrónico y asíncrono definen cómo el cliente (la aplicación que utiliza la tarea) interactúa con el servidor y obtiene el resultado de la tarea. Cuando un servicio se establece en sincrónico, el cliente espera que la tarea finalice. Por lo general, una tarea sincrónica se ejecuta rápidamente, en cinco segundos o menos. Una tarea asíncrona generalmente tarda más tiempo en ejecutarse y el cliente debe preguntar periódicamente al servidor si la tarea no ha terminado y, si ha terminado, obtener el resultado. Una aplicación web con una tarea asíncrona debe tener lógica aplicada para verificar el estado de una tarea y manejar el resultado una vez que finalice la ejecución. Los clientes de ArcGIS Desktop manejan ambos tipos de ejecución de forma nativa. (El valor predeterminado es Asynchronous) | String |
resultMapServer | When publishing a geoprocessing service, you can choose to view the result of all tasks with the service as a map (in addition to other results of your task). The map is created on the server using a Map Service for transport back to the client as an image (a .jpeg, for example). The symbology, labeling, transparency, and all other properties of the returned map are the same as the settings of your output layer. Remember, if you are creating result layers within the Python scripting environment (outside ArcMap), default symbologies will be used. To maintain control over symbology you will need to pre-create layer files with rich symbology and use them to modify the output symbology of your task. When you choose this option, a map service is automatically created on the server with the same name as your geoprocessing service. (El valor predeterminado es False) | Boolean |
showMessages | A string setting the message level for the geoprocessing service. The following is a list of valid message levels the service will return to the client.
(El valor predeterminado es None) | String |
maximumRecords | El número máximo de resultados que el servicio puede devolver a un cliente. La configuración de este valor como un gran número significa que el servidor SIG puede manejar el envío de una gran cantidad de registros o entidades individuales al cliente. Si no desea devolver ninguna entidades, establezca este valor en 0 (cero). Por lo general, establezca este valor en cero sólo cuando habilite Ver resultado con un servicio de mapas. (El valor predeterminado es 1000) | Integer |
minInstances | An integer value representing the minimum number of instances a service will start and make available for use. For heavily used services you may want to increase this value. (El valor predeterminado es 1) | Integer |
maxInstances | An integer value representing the maximum number of instances a service can start and make available for use. For heavily used services you may need to increase this value. Ensure the server has adequate hardware to support the maximum number of instances you will allow. (El valor predeterminado es 2) | Integer |
maxUsageTime | La cantidad máxima de tiempo, en segundos, que un servicio se puede utilizar. Es posible que deba aumentar el valor predeterminado de 600 segundos (10 minutos) para tareas de geoprocesamiento que duren mucho tiempo. Alternativamente, puede ser necesario reducir este tiempo para garantizar que un cliente no abusará de sus servicios. (El valor predeterminado es 600) | Integer |
maxWaitTime | La cantidad máxima de tiempo, en segundos, que el cliente debe esperar para conectarse con una instancia antes de que caduque. Cuando todas las instancias están ocupados procesando solicitudes, las solicitudes posteriores están a la cola. Si este tiempo de inactividad se acaba antes de que esté disponible una instancia, la tarea fallará. El valor predeterminado es 60 segundos (1 minuto). (El valor predeterminado es 60) | Integer |
maxIdleTime | La cantidad máxima de tiempo, en segundos, que una instancia seguirá activa antes de que tenga lugar el acortamiento de grupo Cualquier instancia por encima de la cantidad mínima de instancias que no se han utilizado será cerrada unan vez que se haya terminado el valor máximo de inactividad. (El valor predeterminado es 1800) | Integer |
Valor de retorno
Tipo de datos | Explicación |
Dictionary | Returns a Python Dictionary of information messages, warnings, and errors. |