1
2
3
4
5
6
7 from Ganga.GPIDev.Base import GangaObject
8 from Ganga.GPIDev.Schema import *
9
10 import Ganga.Utility.logging
11 logger = Ganga.Utility.logging.getLogger()
12
13
15 """ This exception may be raised by postprocess hooks to change the job status."""
16 - def __init__(self,status):
17 Exception.__init__(self)
18 self.status = status
19
20
22
23 """
24 Base class for all application objects. Derived classes represent
25 logical applications in the GPI and implement configuration
26 handler functionality. The application configuration is the first
27 phase of job submission.
28
29 General rules for implementing the configure methods:
30
31 In general the configure() and master_configure() methods are
32 called always in the context of job submission, so in principle
33 you may navigate to the associated job object (including backend
34 information). However it is not advised to use backend or extra
35 sandbox information at this point. Code which depends on the
36 backend should be put in application-specific runtime handler
37 which is the next step of job submission.
38
39 The input/output dataset information may be used if neccessary.
40 Objects in the job object tree should not be modified.
41
42 Efficient implementation of splitting:
43
44 If you want to enable the typical case of splitting based on the
45 dataset (defined at the job level) then it is very simple:
46 configure() should only process the inputdata part of the job
47 configuration and master_configure() should do the rest. In that
48 case the splitter should not mutate the application object in the
49 subjobs, because such changes will not be taken into account (and
50 framework will have inconsistent behaviour).
51
52 You may also take an extreme approach and move the entire
53 application configuration to configure(). Arbitrary
54 modifications of the application object in the subjobs which are
55 done by the splitter will take effect. But if the application
56 configuration process is time consuming it will be repeated a
57 number of times which is inneficient.
58
59 Otherwise you should first identify which parts of the
60 application object may be altered by the splitter and process
61 them in configure() method. The master_configure() should
62 perform only the time-consuming part of the configuration which
63 is shared among the subjobs. This means that splitter should not
64 try to modify the application parameters which are used in the
65 common master_configure(). """
66
67 _schema = Schema(Version(0,0), {})
68 _category='applications'
69 _hidden = 1
70
92
93
119
120 - def postprocess(self):
121 """ Postprocessing after the job was reported as completed. By default do nothing.
122 This method may raise an exception PostprocessStatusUpdate('failed'). In this
123 case the job status will be 'failed'. The postprocess_failed() hook will NOT be called."""
124 pass
125
127 """ Postprocessing after the job was reported as failed. By default do nothing."""
128 pass
129
131 """
132 This method will be called just before the status of the parent Job changes to new_status.
133 The default it to do nothing.
134 """
135 pass
136