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

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

Moved location of these guys.

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.ddp_process_support as ddp_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        Username = context.inputs['Username']
23        NumberToDouble = context.inputs['NumberToDouble']
24       
25        context.setStatus(STATUS.STARTED, 'Job is now running', 0)
26
27        # Always need a FileSet, even if empty
28        fileSet = context.outputs['FileSet'] = FileSet()
29
30        # Calculate the outputs
31        DoubledNumber = 2 * NumberToDouble
32        context.outputs['ProcessSpecificContent'] = {"DoubledNumber": DoubledNumber} 
33       
34        filename = 'bar.txt'
35   
36        context.setStatus(STATUS.COMPLETED, 'The End', 100)
37       
38#        ddp_process_support.writeMetadataFile(context, context.inputs.items())
39       
40        completionTime = time.time()
41        ddp_process_support.updateJobDetailsAfterCompletion(context, startTime, completionTime)
42
43
44    def dryRun(self, context):
45
46        # Not implemented for sync jobs
47        pass
Note: See TracBrowser for help on using the repository browser.