00001
00002 """
00003 This is the Runner Class. It should inherit from the PresidenceStack
00004 to allow for operators.
00005 Unless this is not in the given task.
00006 """
00007
00008 __copyright__ = """
00009 Copyright 2008 Sean Ross-Ross
00010 """
00011 __license__ = """
00012 This file is part of SLIMpy .
00013
00014 SLIMpy is free software: you can redistribute it and/or modify
00015 it under the terms of the GNU Lesser General Public License as published by
00016 the Free Software Foundation, either version 3 of the License, or
00017 (at your option) any later version.
00018
00019 SLIMpy is distributed in the hope that it will be useful,
00020 but WITHOUT ANY WARRANTY; without even the implied warranty of
00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
00022 GNU Lesser General Public License for more details.
00023
00024 You should have received a copy of the GNU Lesser General Public License
00025 along with SLIMpy . If not, see <http://www.gnu.org/licenses/>.
00026 """
00027
00028 from slimpy_base.Core.Runners.PresidenceStack import presStack
00029
00030 class dryrunRunner( presStack ):
00031 type = "dryrun"
00032
00033 def __init__( self ):
00034 presStack.__init__( self )
00035
00036 def set_graph(self, graph):
00037 presStack.set_graph( self, graph )
00038
00039
00040 def run( self ):
00041 """
00042 run the current graph with targets
00043 """
00044
00045
00046
00047 command_or_data = self.pull()
00048 numberRan = 0
00049 while command_or_data:
00050 if isinstance( command_or_data, tuple ):
00051 command = command_or_data
00052 items = [ self.table[item] for item in command ]
00053
00054
00055 runnable = self.add( items )
00056
00057
00058 print >> self.log( 1, "command" ), runnable
00059 numberRan += 1
00060 else:
00061 data = command_or_data
00062 self.addSource( data )
00063
00064 self.pop( command_or_data )
00065 command_or_data = self.pull()
00066 return numberRan