As described in A quick tour of authoring and sharing geoprocessing services, authoring a geoprocessing service entails authoring the tasks within the service. Authoring a task means selecting or creating a tool, defining the input and output parameters of the task, and setting the location of any data used by the task. More often then not, you create tasks by sharing custom tools created with ModelBuilder or Python.
ModelBuilder is an application you use to create, edit, and manage models. Models are workflows that string together sequences of geoprocessing tools, feeding the output of one tool into another tool as input. ModelBuilder can be thought of as a visual programming language for building workflows. Models and ModelBuilder allow you to author geoprocessing tasks.
If you have an existing model with parameters that you can run successfully in ArcGIS Desktop, you can share it in a service without modification. The remainder of this topic addresses some of the finer points of authoring tasks with ModelBuilder.
Create a result from a model in ArcGIS Desktop
Create services by right-clicking a result in the Results window. To create a result, run a model as a tool, either by opening its dialog box from the Catalog or the ArcToolbox window, or by running the tool in the Python window.
A result is not created when you run a model within ModelBuilder.
In the vast majority of cases, your model must have parameters. You can see an example of a model tool with parameters in A quick tour of authoring and sharing geoprocessing services. You can learn more about creating model tools in the topic A quick tour of creating tools with ModelBuilder.
Intermediate data is data created by the model but is not an output of the model. Intermediate data created by a task is automatically deleted by ArcGIS Server.
When using ModelBuilder in ArcGIS Desktop, you have to explicitly set model variables as intermediate data for the intermediate data to be deleted after the model is run. This is not the case with server tasks: any data created by the model that is not an output parameter is deleted. You do not have to explicitly set model variables as intermediate as you do when running model tools in ArcGIS Desktop.
Write output data to the in_memory workspace
To improve performance, you can write intermediate and output data to the in_memory workspace.
Do not use the in_memory workspace if you plan to configure your service to have output data drawn by a map service.
When you use result map services, remember there are two services—the geoprocessing service and the map service. These two services execute independently of each other. When the task executes, ArcGIS Server executes the geoprocessing task first, and then executes the map service to draw the output of the geoprocessing task. Because of this execution order, the result map service needs datasets on disk produced by the geoprocessing task. This means that the output of the tasks in the geoprocessing service must be datasets on disk, not in_memory datasets.
Get started with ModelBuilder
If you are unfamiliar with ModelBuilder, the table below lists topics that will help you get started.
Basic concepts of creating your own geoprocessing tools.
These three topics introduce ModelBuilder.
This tutorial shows the basics of connecting tools and data together in ModelBuilder to create a model.
This tutorial shows the basics of creating a tool with ModelBuilder. A model tool is a model that exposes variables as parameters that appear on the tool dialog box when the model is run as a tool. You need parameters to create tasks. The other two topics show how to create model parameters.
You can create choice lists for model variables using value list filters. Choice lists are a great way to present options (choices) to clients of your task.
This topic introduces you to advanced techniques that you may have cause to use when authoring your task with ModelBuilder.