Does anyone know of an example of a leaflet map with a geoprocessing service? Is it possible? What would the code look like?
I know ESRI Leaflet allows feature layers and map layers but I can't find anything on geoprocessing services.
I think there is some misunderstatement of the ArcGIS JS API. Its focused on building Web mapping Clients in the browser, and has nothing to do with ArcGIS Server Geoprocessing. For sure ArcGIS Server Services are the major data source for an ArcGIS JS API App, but, you can also use another JS Framework for building your map app, like leaflet, openlayers or mapbox.
ArcGIS Geoprocessing Services (as any other ArcGIS Server Service) can be called via the REST API. It`s well documented here (http://resources.arcgis.com/en/help/main/10.1/index.html#/Task_operation_execute_REST/0057000000m5000000/)
I would recommend a Library like jQuery to to call the REST API in an AJAX like style, Then, depending on what your Geoprocessing Tool does, get the response, build some JS Objects out of it (Leaflet markers, or whatever) and present it. Thats all. So, to answer your question: Yes for sure it is possible. How it looks like, depends on the tool you are planning to integrate. Perhaps you could describe more precisely what you are planning to solve in your app.
esri/tasks/Geoprocessor part. Examples like this seem to separate the Geoprocessing tool call pretty cleanly from the mapping part; should be easy enough to adapt to your web application.
You might want to check this out.
Is there a benefit in having this tool used on an open-source platform?