def process_month_hours(month_date, start_hour=0, days=None):
 (year, month) = month_date.split('-')
 (year, month) = (int(year), int(month))
 days = (days or xrange(1, (calendar.monthrange(year, month)[1] + 1)))
 hours = xrange(start_hour, 24)
 for day in days:
  for hour in hours:
   hour_date = ('%04d-%02d-%02d-%02d' % (year, month, day, hour))
   log_path = os.path.join(RAW_LOG_DIR, ('%s.log.gz' % hour_date))
   if (not s3_key_exists(s3_connection, log_path)):
    log_path = os.path.join(RAW_LOG_DIR, ('%s.log.bz2' % hour_date))
    if (not s3_key_exists(s3_connection, log_path)):
     print ('Missing log for %s' % hour_date)
     continue
   print ('Processing %s' % log_path)
   process_pixel_log(log_path, fast=True)
  hours = xrange(24)

def process_month_hours ( month_date , start_hour = 0 , days = None ) : ( year , month ) = month_date . split ( '-' ) ( year , month ) = ( int ( year ) , int ( month ) ) days = ( days or xrange ( 1 , ( calendar . monthrange ( year , month ) [ 1 ] + 1 ) ) ) hours = xrange ( start_hour , 24 ) for day in days : for hour in hours : hour_date = ( '%04d-%02d-%02d-%02d' % ( year , month , day , hour ) ) log_path = os . path . join ( RAW_LOG_DIR , ( '%s.log.gz' % hour_date ) ) if ( not s3_key_exists ( s3_connection , log_path ) ) : log_path = os . path . join ( RAW_LOG_DIR , ( '%s.log.bz2' % hour_date ) ) if ( not s3_key_exists ( s3_connection , log_path ) ) : print ( 'Missing log for %s' % hour_date ) continue print ( 'Processing %s' % log_path ) process_pixel_log ( log_path , fast = True ) hours = xrange ( 24 )
process hourly logs from entire month .