Exemplo n.º 1
0
 def __init__(self, config_file=None, mimetype_files=None):
     ScriptBase.__init__(self, config_file)
     self.name = self.__class__.__name__
     self.working_dir = boto.config.get('Pyami', 'working_dir')
     self.sd = ServiceDef(config_file)
     self.retry_count = self.sd.getint('retry_count', 5)
     self.loop_delay = self.sd.getint('loop_delay', 30)
     self.processing_time = self.sd.getint('processing_time', 60)
     self.input_queue = self.sd.get_obj('input_queue')
     self.output_queue = self.sd.get_obj('output_queue')
     self.output_domain = self.sd.get_obj('output_domain')
     if mimetype_files:
         mimetypes.init(mimetype_files)
Exemplo n.º 2
0
 def main(self):
     self.options, self.args = self.parser.parse_args()
     if self.options.help_commands:
         self.print_command_help()
         sys.exit(0)
     if len(self.args) != 2:
         self.parser.error("config_file and command are required")
     self.config_file = self.args[0]
     self.sd = ServiceDef(self.config_file)
     self.command = self.args[1]
     if hasattr(self, 'do_%s' % self.command):
         method = getattr(self, 'do_%s' % self.command)
         method()
     else:
         self.parser.error('command (%s) not recognized' % self.command)