Clean : (Grégory Starck) clean of some getattr code, bis.
[shinken.git] / shinken / modules / dummy_scheduler.py
blob1a28481a46b8d3fe24a5d54af83b090e0b83b43f
1 #!/usr/bin/python
2 #Copyright (C) 2009 Gabes Jean, naparuba@gmail.com
4 #This file is part of Shinken.
6 #Shinken is free software: you can redistribute it and/or modify
7 #it under the terms of the GNU Affero General Public License as published by
8 #the Free Software Foundation, either version 3 of the License, or
9 #(at your option) any later version.
11 #Shinken is distributed in the hope that it will be useful,
12 #but WITHOUT ANY WARRANTY; without even the implied warranty of
13 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 #GNU Affero General Public License for more details.
16 #You should have received a copy of the GNU Affero General Public License
17 #along with Shinken. If not, see <http://www.gnu.org/licenses/>.
20 #This Class is an example of an Scheduler module
21 #Here for the configuration phase AND running one
24 #This text is print at the import
25 print "Detected module : Dummy module for Scheduler"
29 properties = {
30 'type' : 'dummy_scheduler',
31 'external' : False,
32 'phases' : ['retention'],
36 #called by the plugin manager to get a broker
37 def get_instance(plugin):
38 print "Get a Dummy scheduler module for plugin %s" % plugin.get_name()
39 instance = Dummy_scheduler(plugin.get_name())
40 return instance
44 #Just print some stuff
45 class Dummy_scheduler:
46 def __init__(self, name):
47 self.name = name
49 #Called by Scheduler to say 'let's prepare yourself guy'
50 def init(self):
51 print "Initilisation of the dummy scheduler module"
52 #self.return_queue = self.properties['from_queue']
55 def get_name(self):
56 return self.name
59 #Ok, main function that is called in the retention creation pass
60 def update_retention_objects(self, sched, log_mgr):
61 print "[Dummy] asking me to update the retention objects"
64 #Should return if it succeed in the retention load or not
65 def load_retention_objects(self, sched, log_mrg):
66 print "[Dummy] asking me to load the retention objects"
67 return False
69 #From now external is not used in the scheduler job
70 # #When you are in "external" mode, that is the main loop of your process
71 # def main(self):
72 # while True:
73 # print "Raise a external command as example"
74 # e = ExternalCommand('Viva la revolution')
75 # self.return_queue.put(e)
76 # time.sleep(1)