source: cows_wps/trunk/process_modules/double_it.py @ 7014

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/cows_wps/trunk/process_modules/double_it.py@7014
Revision 7014, 1.3 KB checked in by astephen, 10 years ago (diff)

renamed ddp_process_support to process_support

Line 
1"""
2double_it.py
3=============
4
5A very trivial synchronous example using the process_handler interface.
6
7"""
8
9import os, stat, time
10
11from cows_wps.process_handler.fileset import FileSet, FLAG
12import cows_wps.process_handler.process_support as process_support
13from cows_wps.process_handler.context.process_status import STATUS
14
15class DoubleIt(object):
16    def __call__(self, context):
17       
18        startTime = time.time()
19        jobId = os.path.basename(context.processDir)
20
21        # Parse the inputs
22        NumberToDouble = context.inputs['NumberToDouble']
23       
24        context.setStatus(STATUS.STARTED, 'Job is now running', 0)
25
26        # Always need a FileSet, even if empty
27        fileSet = context.outputs['FileSet'] = FileSet()
28
29        # Calculate the outputs
30        DoubledNumber = 2 * NumberToDouble
31        context.outputs['ProcessSpecificContent'] = {"DoubledNumber": DoubledNumber} 
32       
33        filename = 'bar.txt'
34   
35        context.setStatus(STATUS.COMPLETED, 'The End', 100)
36       
37#        process_support.writeMetadataFile(context, context.inputs.items())
38       
39        completionTime = time.time()
40        process_support.updateJobDetailsAfterCompletion(context, startTime, completionTime)
41
42
43    def dryRun(self, context):
44
45        # Not implemented for sync jobs
46        pass
Note: See TracBrowser for help on using the repository browser.