Permalink
Browse files

Adding reasonable logging output to each post processor.

  • Loading branch information...
robhudson committed Apr 9, 2009
1 parent 7bd7926 commit 871b3c6269dc4ed14783f18e45bf91354e6247e7
Showing with 7 additions and 4 deletions.
  1. +7 −4 dumpy/dumper.py
View
@@ -228,7 +228,6 @@ def process(self, file):
processors = [p.strip() for p in self.processors.split(',')]
for processor in processors:
- logger.info('%s - %s' % (self.db, processor))
file = globals()[processor](self.db).process(file)
class Bzip(PostProcessBase):
@@ -247,7 +246,7 @@ def process(self, file):
self.parse_config()
cmd = "%(path)s -f '%(file)s'" % ({'path': self.path, 'file': file.name})
- logger.info('%s - %s' % (self.db, cmd))
+ logger.info('%s - %s - Command: %s' % (self.db, self.__class__.__name__, cmd))
os.system(cmd)
new_file = open('%s.bz2' % (file.name))
file.close()
@@ -264,7 +263,7 @@ def parse_config(self):
super(TimestampRename, self).parse_config()
self.format = self._get_option_value(self.config, 'TimestampRename options', 'format')
self.insert_db_name = self._get_option_value(self.config, 'database %s' % (self.db), 'insert_db_name', 'boolean')
-
+
def process(self, file):
self.parse_config()
@@ -278,10 +277,11 @@ def process(self, file):
new_file_name = file_name_format % (dir, datetime.datetime.now().strftime(self.format), ext)
shutil.copy(file.name, new_file_name)
+ logger.info('%s - %s - Copying %s to %s' % (self.db, self.__class__.__name__, file.name, new_file_name))
new_file = open(new_file_name)
file.close()
return new_file
-
+
class SystemFileCopy(PostProcessBase):
"""
@@ -307,6 +307,7 @@ def process(self, file):
new_file_name = '%s/%s%s' % (self.dir, base, ext)
shutil.copy(file.name, new_file_name)
+ logger.info('%s - %s - Copying %s to %s' % (self.db, self.__class__.__name__, file.name, new_file_name))
new_file = open(new_file_name)
# TODO:
# This should probably not return the new file but return the original.
@@ -340,6 +341,8 @@ def process(self, file):
k.key = file.name
k.set_contents_from_file(file)
+ logger.info('%s - %s - Copying to S3 with key name: %s' % (self.db, self.__class__.__name__, file.name))
+
return file
if __name__ == '__main__':

0 comments on commit 871b3c6

Please sign in to comment.