Lines Matching +full:not +full:- +full:date
3 # Use of this source code is governed by a BSD-style license that can be
19 # Format Appears as: [Date] [Time] - [Msg Level] - [Message]
20 LOGGING_FORMAT = '%(asctime)s - %(levelname)s - %(message)s'
21 # This regex makes sure the input is in the format of YYYY-MM-DD (2012-02-01)
22 DATE_FORMAT_REGEX = ('^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]'
26 WHERE %(table)s.%(time_column)s <= "%(date)s"
32 WHERE %(related_table)s.%(time_column)s <= "%(date)s"
42 WHERE %(related_table)s.%(time_column)s <= "%(date)s"
56 # db_cleanup may delete stuff from the global database, which is generally not
95 bartext = '=' * (barlen-1) + '>'
130 date, foreign_key=None,
142 tko_tests.started_time <= '2012-02-01';
149 @param related_table: Table with the date information we are selecting by.
153 @param date: End date of the information we are trying to delete.
154 @param time_column: Column that we want to use to compare the date to.
156 delete with the table with the date information.
161 to the table with the date information.
163 if not foreign_key:
166 if not related_table:
169 time_column=time_column, date=date)
171 elif not indirection_table:
172 # Deleting using a single JOIN to get the date information.
176 time_column=time_column, date=date)
188 time_column=time_column, date=date)
196 if not rows or rows == [None]:
213 def _subtract_days(date, days_to_subtract): argument
215 Return a date (string) that is 'days' before 'date'
217 @param date: date (string) we are subtracting from.
220 date_obj = datetime.datetime.strptime(date, '%Y-%m-%d')
221 difference = date_obj - datetime.timedelta(days=days_to_subtract)
222 return difference.strftime('%Y-%m-%d')
225 def _delete_all_data_before_date(date): argument
227 Delete all the database data before a given date.
230 However not all jobs in afe_jobs are also in tko_jobs.
233 days before date. Then we do the queries using tko_jobs and these
239 @param date: End date of the information we are trying to delete.
242 # First cleanup all afe_job related data (prior to 2 days before date).
243 # The reason for this is not all afe_jobs may be in tko_jobs.
244 afe_date = _subtract_days(date, 2)
284 # date.
286 date)
289 date, foreign_key=TEST_IDX)
292 date, foreign_key= 'test_id')
295 date)
298 date)
301 date)
304 date, foreign_key='job_id')
307 'tko_jobs', AFE_JOB_ID, date,
314 date, foreign_key='queue_entry_id',
320 date, foreign_key='job_id')
323 date, foreign_key='job_id')
326 date, foreign_key='job_id')
329 date, foreign_key='id')
332 date, foreign_key=JOB_IDX)
334 None, None, date)
340 parser.add_argument('-v', '--verbose', action='store_true',
342 parser.add_argument('--step', type=int, action='store',
345 parser.add_argument('date', help='Keep results newer than')
357 if not re.match(DATE_FORMAT_REGEX, args.date):
358 print 'DATE must be in yyyy-mm-dd format!'
363 _delete_all_data_before_date(args.date)