1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 __authors__ = [ "Marie-Francoise Incardona", "Olof Svensson", "Jérôme Kieffer" ]
31 __contact__ = "svensson@esrf.fr"
32 __license__ = "LGPLv3+"
33 __copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
34
35
36 from EDPlugin import EDPlugin
37 from EDUtilsParallel import EDUtilsParallel
38 from EDVerbose import EDVerbose
39
40
42 """
43 Super class for all plugins that execute something.
44 For now, does nothing.
45 """
46
47
49 """
50 preProcess of the plugin:
51 Ensure a CPU resource is available for the processing by acquiring a semaphore
52 """
53 EDVerbose.DEBUG("Acquire semaphore nbCPU by plugin %s, currently value: %s" % (self.getPluginName(), EDUtilsParallel.getSemaphoreValue()))
54 EDUtilsParallel.semaphoreNbThreadsAcquire()
55 EDPlugin.preProcess(self, _edObject)
56
57
59 """
60 after processing of the plugin:
61 Release a CPU resource by releasing the semaphore
62 """
63 EDVerbose.DEBUG("Release semaphore nbCPU by plugin %s, currently value: %s" % (self.getPluginName(), EDUtilsParallel.getSemaphoreValue()))
64 EDUtilsParallel.semaphoreNbThreadsRelease()
65 EDPlugin.finallyProcess(self, _edObject)
66