Skip to content

4. Deploy and Undeploy Algorithms

Spacebel sa edited this page Oct 26, 2017 · 22 revisions

Algorithms DeployProcess and UndeployProcess allows to perform the transactional operations without the need to extend the specification.

Indeed, instead of new operations, the deployment and undeployment are performed using built-in WPS processes which acts exactly the same as the transactional operations.

Note the example below are based on our sample LandCover Mapping Process (described here).

Process Descriptions

This section shows the process description (actually ProcessOffering) of the DeployProcess and UndeployProcess algorithms.

DeployProcess Description

The DeployProcess process takes as input an ApplicationPackage and returns a DeployProcessResponse output. Note that the DeployProcessResponse is exactly the transactional operation response (i.e. DeployResult) as defined in Deploy operation schema.

<?xml version="1.0" encoding="UTF-8"?>
<wps:ProcessOfferings xmlns:wps="http://www.opengis.net/wps/2.0" xmlns:ows="http://www.opengis.net/ows/2.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.opengis.net/wps/2.0 http://schemas.opengis.net/wps/2.0/wps.xsd">
    <wps:ProcessOffering jobControlOptions="async-execute dismiss" outputTransmission="value reference">
        <wps:Process>
            <ows:Title>Deploy Process</ows:Title>
            <ows:Abstract>This method will deploy an application encapsulated within a Docker container as a process accessible through the WPS interface.</ows:Abstract>
            <ows:Identifier>DeployProcess</ows:Identifier>
            <wps:Input>
                <ows:Title>Application Package</ows:Title>
                <ows:Abstract>A TB13 EOC application package, encoded as an ATOM-encoded OGC context document, describing the details of the application.</ows:Abstract>
                <ows:Identifier>applicationPackage</ows:Identifier>
                <wps:ComplexData>
                    <wps:Format mimeType="text/xml"
                                default="true"/>
                    <!-- Case of OWC atom feed -->
                    <wps:Format mimeType="application/atom+xml" encoding="UTF-8"/>
                </wps:ComplexData>
            </wps:Input>
            <wps:Output>
                <ows:Title>Deploy Process Response</ows:Title>
                <ows:Abstract>The response to registering an application</ows:Abstract>
                <ows:Identifier>deployResult</ows:Identifier>
                <wps:ComplexData>
                    <wps:Format mimeType="text/xml" encoding="UTF-8" default="true"
                                schema="https://raw.githubusercontent.com/spacebel/common-xml/master/52n-ogc-schema/src/main/resources/META-INF/xml/wps/t/wpsDeployProcess.xsd"/>
                </wps:ComplexData>
            </wps:Output>
        </wps:Process>
    </wps:ProcessOffering>
</wps:ProcessOfferings>

DeployProcess ApplicationPackage

The WPS ApplicationPackage contains the Process Description of the WPS Process (e.g. LandCover) to be deployed. The package shall be provided using the usual WPS format, i.e a <wps:ProcessOffering> document.

For some project-specific reasons, the additional OWS Context format (OWC) is also supported. The implementation will simply transform the OWC document into the usual ProcessOffering format (with Atom Entries included in the <ows:Metadata> element). You may compare the format looking at the LandCover example here : OWC Format - WPS Format

UndeployProcess Description

The UndeployProcess process takes as input a ProcessIdentifier and returns a UndeployProcessResponse output. Note that the UndeployProcessResponse is exactly the transactional operation response (i.e. UndeployResult) as defined in Undeploy operation schema.

<?xml version="1.0" encoding="UTF-8"?>
<wps:ProcessOfferings xmlns:wps="http://www.opengis.net/wps/2.0" xmlns:ows="http://www.opengis.net/ows/2.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="http://www.opengis.net/wps/2.0 http://schemas.opengis.net/wps/2.0/wps.xsd">
	<wps:ProcessOffering jobControlOptions="async-execute dismiss" outputTransmission="value reference">
		<wps:Process>
			<ows:Title>Undeploy Process</ows:Title>
			<ows:Abstract>This method will undeploy an application encapsulated within a Docker container that was deployed through the WPS interface.</ows:Abstract>
			<ows:Identifier>UndeployProcess</ows:Identifier>
			<wps:Input>
				<ows:Title>Process Identifier</ows:Title>
				<ows:Abstract>The identifier of the process to be undeployed e.g. LandCover</ows:Abstract>
				<ows:Identifier>processIdentifier</ows:Identifier>
				<wps:LiteralData>
					<wps:Format mimeType="text/plain" default="true"/>
					<LiteralDataDomain default="true">
						<ows:AnyValue/>
						<ows:DataType ows:reference="http://www.w3.org/2001/XMLSchema#string">String</ows:DataType>
					</LiteralDataDomain>
				</wps:LiteralData>
			</wps:Input>
			<wps:Output>
				<ows:Title>Undeploy Process Response</ows:Title>
				<ows:Abstract>The response to deregistering an application.</ows:Abstract>
				<ows:Identifier>undeployResult</ows:Identifier>
				<wps:ComplexData>
					<wps:Format mimeType="text/xml" encoding="UTF-8" default="true" schema="https://raw.githubusercontent.com/spacebel/common-xml/master/52n-ogc-schema/src/main/resources/META-INF/xml/wps/t/wpsUndeployProcess.xsd"/>
				</wps:ComplexData>
			</wps:Output>
		</wps:Process>
	</wps:ProcessOffering>
</wps:ProcessOfferings>

Examples

Deploy Request By Reference

<?xml version="1.0" encoding="UTF-8"?>
<wps:Execute xmlns:wps="http://www.opengis.net/wps/2.0" xmlns:ows="http://www.opengis.net/ows/2.0" xmlns:xlink="http://www.w3.org/1999/xlink" service="WPS" version="2.0.0" response="document" mode="sync" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<ows:Identifier>DeployProcess</ows:Identifier>
	<wps:Input id="applicationPackage">
		<wps:Reference mimeType="text/xml" xlink:href="http://raw.githubusercontent.com/spacebel/WPS/wps2.0-transactional/52n-wps-eoc/src/main/resources/examples/landcover-applicationPackage-owc.xml"/>
	</wps:Input>
	<wps:Output id="deployResult" transmission="value"/>
</wps:Execute>

(raw)

Deploy Request By Value

In this example, the ApplicationPackage is passed directly by value. The document illustrated below was reduced for readability (by removing the OWC feed) but the whole XML example is available here: DeployProcess Request by Value

<?xml version="1.0" encoding="UTF-8"?>
<wps:Execute xmlns:wps="http://www.opengis.net/wps/2.0" xmlns:ows="http://www.opengis.net/ows/2.0" xmlns:xlink="http://www.w3.org/1999/xlink" service="WPS" version="2.0.0" response="document" mode="sync" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<ows:Identifier>DeployProcess</ows:Identifier>
	<wps:Input id="applicationPackage">
		<wps:Data>
			<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" xmlns:ows="http://www.opengis.net/ows/2.0" xmlns:owc="http://www.opengis.net/owc/1.0" xmlns:os="http://a9.com/-/spec/opensearch/1.1/" xml:lang="en">
           [ATOM FEED CONTENT]
			</feed>
		</wps:Data>
	</wps:Input>
	<wps:Output id="deployResult" transmission="value"/>
</wps:Execute>

(raw)

Deploy Response

<wps:Result xsi:schemaLocation="http://www.opengis.net/wps/2.0 http://schemas.opengis.net/wps/2.0/wps.xsd" xmlns:wps="http://www.opengis.net/wps/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <wps:JobID>3693060b-2738-48d4-8033-c8cec56d2435</wps:JobID>
   <wps:Output id="deployResult">
      <wps:Data mimeType="application/atom+xml">
         <ns:DeployResult xmlns:ns="http://www.opengis.net/wps/2.0">
            <ns:DeploymentDone>true</ns:DeploymentDone>
         </ns:DeployResult>
      </wps:Data>
   </wps:Output>
</wps:Result>

(raw)

Undeploy request

<?xml version="1.0" encoding="UTF-8"?>
<wps:Execute xmlns:wps="http://www.opengis.net/wps/2.0" xmlns:ows="http://www.opengis.net/ows/2.0" xmlns:xlink="http://www.w3.org/1999/xlink" service="WPS" version="2.0.0" response="document" mode="sync" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<ows:Identifier>UndeployProcess</ows:Identifier>
	<wps:Input id="processIdentifier">
		<wps:Data mimeType="text/xml">
			<wps:LiteralValue>LandCover</wps:LiteralValue>
		</wps:Data>
	</wps:Input>
	<wps:Output id="undeployResult" transmission="reference"/>
</wps:Execute>

(raw)

Undeploy response

<wps:Result xsi:schemaLocation="http://www.opengis.net/wps/2.0 http://schemas.opengis.net/wps/2.0/wps.xsd" xmlns:wps="http://www.opengis.net/wps/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlin="http://www.w3.org/1999/xlink">
   <wps:JobID>8e89cba9-0dc2-4203-b13a-15f9d0cec99b</wps:JobID>
   <wps:Output id="undeployResult">
      <wps:Reference mimeType="application/atom+xml" xlin:href="http://localhost:8081/wps/RetrieveResultServlet?id=8e89cba9-0dc2-4203-b13a-15f9d0cec99bundeployResult.2c4da835-59cc-4252-8b68-69f08b1976f5"/>
   </wps:Output>
</wps:Result>

(raw)