source: cows_wps/trunk/cows_wps/templates/defs.xml @ 5615

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/cows_wps/trunk/cows_wps/templates/defs.xml@5615
Revision 5615, 3.1 KB checked in by spascoe, 11 years ago (diff)

COWS WPS package copied from
 http://proj.badc.rl.ac.uk/svn/dcip/cows-wps/trunk.

This is a stripped down version of the DDP WPS. Some features are
removed and others have been deactivated until we reimplement them in a
more generic way.

Line 
1<?xml version="1.0" encoding="UTF-8"?>
2<!--! This template contains various functions for rendering bits of
3    ExecuteResponse and DCIP-specific XML.
4-->
5<?python
6    from cows_wps.process_handler.context.process_status import STATUS
7    from routes import url_for
8?>
9<defs xmlns:py="http://genshi.edgewall.org/" py:strip="True">
10    <?python
11        def renderStatus(context):
12            if context.status == STATUS.ACCEPTED:
13                s = 'ProcessAccepted'
14            elif context.status == STATUS.STARTED:
15                s = 'ProcessStarted'
16            elif context.status == STATUS.COMPLETED:
17                s = 'ProcessCompleted'
18            elif context.status == STATUS.FAILED:
19                s = 'ProcessFailed'
20            else:
21                s = ''
22           
23            return '%s:%s:%s' % (s, context.percentComplete, context.statusMessage)
24    ?>
25   
26    <?python
27    from genshi.builder import tag, Element
28    def markupProcessSpecificContent(context):
29        PSCElement = tag.ProcessSpecificContent
30       
31        d = context.outputs.get('ProcessSpecificContent')
32       
33        if type(d) != dict:
34            return PSCElement
35   
36        items = d.items()
37        items.sort()
38        for key, value in items:
39            PSCElement(Element(key)(value))("\n")
40   
41        return PSCElement
42    ?>
43       
44    <FileSet py:def="markupFileSet(fileSet, jobId)">
45        ${markupFileSetContents(fileSet, jobId)}
46    </FileSet>
47   
48    <py:def function="markupFileSetContents(fileSet, jobId)">
49        <FileDetails py:for="file in fileSet.contents">
50            <FileURL py:content="url_for(controller='/download', jobId=jobId, fileName=file.name, qualified=True)"/>
51            <FileSize py:content="file.size"/>
52            <FileInfo py:content="file.info"/>
53            <FileType py:content="file.flag"/>
54            <FileCapabilities py:content="file.capabilities"/>
55            <FileContents py:if="file.flag == 'zip'">   
56                ${markupFileSetContents(file, jobId)}
57            </FileContents>
58            <py:if test="file.flag != 'zip'">
59            <FileContents />
60            </py:if>   
61        </FileDetails>
62    </py:def>
63
64   
65       
66    <JobDetails py:def="markupJobDetails(context, fullDetails=False)">
67        <?python jd = context.outputs['job_details'] ?>
68        <JobID py:content="jd['job_id']"/>
69        <JobUnixCompletionTime py:content="jd.get('completion_time')"/>
70        <JobCompletionTimeDate py:content="jd.get('completion_date_time')"/>
71        <JobSubmissionTime py:content="jd.get('submission_date_time')"/>
72        <JobCapabilities py:content="jd.get('job_capabilities')"/>
73        <JobDuration>
74            <py:if test="jd.has_key('duration')">
75                ${jd['duration']}
76            </py:if>
77        </JobDuration>
78        <JobVolume py:content="jd.get('job_volume')"/>
79        <RequestDescription py:content="jd.get('RequestDescription')"/>
80        <RequestType py:content="jd.get('RequestType')"/>
81       
82        <py:if test="str(fullDetails) == 'True'">
83            ${markupFileSet(context.outputs['FileSet'], jd['job_id'])}           
84        </py:if>
85   
86    </JobDetails>
87</defs>
Note: See TracBrowser for help on using the repository browser.