1
2 """Contains all processes """
3 __docformat__ = "restructuredtext"
4
5 from mrv.automation.process import ProcessBase
6 import mrv.util as util
7
8
10 """Parse all processes from the given package's sub-modules and add them to main
11 processes module to make them available to the workflow system
12
13 :param importBase: Something like: parentPackage.subpackage.mypackage, of your processes package
14 :param packageFile: the pointing to your processes package, usually __file__ of your package
15 """
16 isProcess = lambda cls: hasattr( cls, 'mro' ) and ProcessBase in cls.mro()
17 processes = util.getPackageClasses( importBase, packageFile, predicate = isProcess )
18
19 gd = globals()
20 for pcls in processes:
21 gd[pcls.__name__] = pcls
22
23
25 """Add the given process classes to the list of known process types. They will be regeistered
26 with their name obtained by str( processCls ).
27 Workflows loaded from files will have access to the processes in this package
28
29 :param args: process classes to be registered to this module."""
30 gd = globals();
31 for pcls in args:
32 if ProcessBase not in pcls.mro():
33 raise TypeError( "%r does not support the process interface" % pcls )
34
35 gd[pcls.__name__] = pcls
36
37
38
39
40
41
42