• 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
21 # Format Appears as: [Date] [Time] - [Msg Level] - [Message]
22 LOGGING_FORMAT = '%(asctime)s - %(levelname)s - %(message)s'
23 # This regex makes sure the input is in the format of YYYY-MM-DD (2012-02-01)
24 DATE_FORMAT_REGEX = ('^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]'
28 WHERE %(table)s.%(time_column)s <= "%(date)s"
34 WHERE %(related_table)s.%(time_column)s <= "%(date)s"
44 WHERE %(related_table)s.%(time_column)s <= "%(date)s"
58 # db_cleanup may delete stuff from the global database, which is generally not
100 bartext = '=' * (barlen-1) + '>'
135 date, foreign_key=None,
147 tko_tests.started_time <= '2012-02-01';
154 @param related_table: Table with the date information we are selecting by.
158 @param date: End date of the information we are trying to delete.
159 @param time_column: Column that we want to use to compare the date to.
161 delete with the table with the date information.
166 to the table with the date information.
168 if not foreign_key:
171 if not related_table:
174 time_column=time_column, date=date)
176 elif not indirection_table:
177 # Deleting using a single JOIN to get the date information.
181 time_column=time_column, date=date)
193 time_column=time_column, date=date)
201 if not rows or rows == [None]:
214 if not DRY_RUN:
225 time.sleep((end - start) / LOAD_RATIO)
228 def _subtract_days(date, days_to_subtract): argument
230 Return a date (string) that is 'days' before 'date'
232 @param date: date (string) we are subtracting from.
235 date_obj = datetime.datetime.strptime(date, '%Y-%m-%d')
236 difference = date_obj - datetime.timedelta(days=days_to_subtract)
237 return difference.strftime('%Y-%m-%d')
240 def _delete_all_data_before_date(date): argument
242 Delete all the database data before a given date.
245 However not all jobs in afe_jobs are also in tko_jobs.
248 days before date. Then we do the queries using tko_jobs and these
254 @param date: End date of the information we are trying to delete.
257 # First cleanup all afe_job related data (prior to 2 days before date).
258 # The reason for this is not all afe_jobs may be in tko_jobs.
259 afe_date = _subtract_days(date, 2)
299 # date.
301 date)
304 date, foreign_key=TEST_IDX)
307 date, foreign_key= 'test_id')
310 date)
313 date)
316 date)
319 date, foreign_key='job_id')
322 'tko_jobs', AFE_JOB_ID, date,
329 date, foreign_key='queue_entry_id',
335 date, foreign_key='job_id')
338 date, foreign_key='job_id')
341 date, foreign_key='job_id')
344 date, foreign_key='id')
347 date, foreign_key=JOB_IDX)
349 None, None, date)
355 parser.add_argument('-v', '--verbose', action='store_true',
357 parser.add_argument('--step', type=int, action='store',
360 parser.add_argument('--dry_run', action='store_true',
362 parser.add_argument('--load_ratio', type=float, action='store', default=0.2,
364 'performing deletes. For example --load_ratio=.2 '
367 parser.add_argument('date', help='Keep results newer than')
379 if not re.match(DATE_FORMAT_REGEX, args.date):
380 print 'DATE must be in yyyy-mm-dd format!'
388 _delete_all_data_before_date(args.date)