• Home
  • Raw
  • Download

Lines Matching +full:not +full:- +full:date

3 # Use of this source code is governed by a BSD-style license that can be
20 # Format Appears as: [Date] [Time] - [Msg Level] - [Message]
21 LOGGING_FORMAT = '%(asctime)s - %(levelname)s - %(message)s'
22 # This regex makes sure the input is in the format of YYYY-MM-DD (2012-02-01)
23 DATE_FORMAT_REGEX = ('^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]'
27 WHERE %(table)s.%(time_column)s <= "%(date)s"
33 WHERE %(related_table)s.%(time_column)s <= "%(date)s"
43 WHERE %(related_table)s.%(time_column)s <= "%(date)s"
57 # db_cleanup may delete stuff from the global database, which is generally not
96 bartext = '=' * (barlen-1) + '>'
131 date, foreign_key=None,
143 tko_tests.started_time <= '2012-02-01';
150 @param related_table: Table with the date information we are selecting by.
154 @param date: End date of the information we are trying to delete.
155 @param time_column: Column that we want to use to compare the date to.
157 delete with the table with the date information.
162 to the table with the date information.
164 if not foreign_key:
167 if not related_table:
170 time_column=time_column, date=date)
172 elif not indirection_table:
173 # Deleting using a single JOIN to get the date information.
177 time_column=time_column, date=date)
189 time_column=time_column, date=date)
197 if not rows or rows == [None]:
214 def _subtract_days(date, days_to_subtract): argument
216 Return a date (string) that is 'days' before 'date'
218 @param date: date (string) we are subtracting from.
221 date_obj = datetime.datetime.strptime(date, '%Y-%m-%d')
222 difference = date_obj - datetime.timedelta(days=days_to_subtract)
223 return difference.strftime('%Y-%m-%d')
226 def _delete_all_data_before_date(date): argument
228 Delete all the database data before a given date.
231 However not all jobs in afe_jobs are also in tko_jobs.
234 days before date. Then we do the queries using tko_jobs and these
240 @param date: End date of the information we are trying to delete.
243 # First cleanup all afe_job related data (prior to 2 days before date).
244 # The reason for this is not all afe_jobs may be in tko_jobs.
245 afe_date = _subtract_days(date, 2)
285 # date.
287 date)
290 date, foreign_key=TEST_IDX)
293 date, foreign_key= 'test_id')
296 date)
299 date)
302 date)
305 date, foreign_key='job_id')
308 'tko_jobs', AFE_JOB_ID, date,
315 date, foreign_key='queue_entry_id',
321 date, foreign_key='job_id')
324 date, foreign_key='job_id')
327 date, foreign_key='job_id')
330 date, foreign_key='id')
333 date, foreign_key=JOB_IDX)
335 None, None, date)
341 parser.add_argument('-v', '--verbose', action='store_true',
343 parser.add_argument('--step', type=int, action='store',
346 parser.add_argument('-c', '--check_server', action='store_true',
348 parser.add_argument('date', help='Keep results newer than')
370 if not re.match(DATE_FORMAT_REGEX, args.date):
371 print 'DATE must be in yyyy-mm-dd format!'
373 if args.check_server and not should_cleanup():
379 _delete_all_data_before_date(args.date)