Compare commits

...

2 Commits

Author SHA1 Message Date
Kirill Zhukov 40ce2c583d Release 0.3.2 (2023-03-23)
- Bugfix ALBS-1060
2023-03-23 13:06:43 +01:00
Kirill Zhukov 4145ce8e9e Bugfix ALBS-1060 2023-03-23 13:04:28 +01:00
4 changed files with 16 additions and 11 deletions

View File

@ -246,17 +246,18 @@ class DB():
val = int(cur.fetchone()[0]) val = int(cur.fetchone()[0])
return val == 1 return val == 1
def get_build_tasks_for_unfinished_tests(self, not_before: datetime) -> List[int]: def get_build_tasks_for_tests_update(self, not_before: datetime) -> List[int]:
''' '''
getting build tasks id of unfinished test tasks Getting build tasks id for test tasks that we need to update
https://cloudlinux.atlassian.net/browse/ALBS-1060
''' '''
cur = self.__conn.cursor() cur = self.__conn.cursor()
sql = ''' sql = '''
SELECT DISTINCT bt.id SELECT bt.id
FROM build_tasks as bt FROM build_tasks AS bt
INNER JOIN test_tasks AS tt INNER JOIN builds AS b
ON bt.id = tt.build_task_id ON b.id = bt.build_id
WHERE tt.status_id < 3 AND bt.started_at > %s; WHERE b.created_at > %s;
''' '''
cur.execute(sql, (not_before.timestamp(),)) cur.execute(sql, (not_before.timestamp(),))
logging.debug('raw SQL query: %s', cur.query) logging.debug('raw SQL query: %s', cur.query)

View File

@ -131,8 +131,9 @@ class Extractor:
build_id, err, exc_info=True) build_id, err, exc_info=True)
def updating_test_tasks(self): def updating_test_tasks(self):
logging.info('getting build task ids of unfinished tests') logging.info('getting build tasks for builds created after %s',
build_task_ids = self.db.get_build_tasks_for_unfinished_tests( self.config.oldest_to_update)
build_task_ids = self.db.get_build_tasks_for_tests_update(
self.config.oldest_to_update) self.config.oldest_to_update)
for build_task_id in build_task_ids: for build_task_id in build_task_ids:
try: try:

View File

@ -95,7 +95,7 @@ def start(yml_path: str):
else: else:
logging.info('update finished') logging.info('update finished')
logging.info('updating statuses of unfinished test tasks') logging.info('updating/inserting test tasks')
try: try:
extractor.updating_test_tasks() extractor.updating_test_tasks()
except Exception as err: # pylint: disable=broad-except except Exception as err: # pylint: disable=broad-except

View File

@ -16,4 +16,7 @@ First version
0.3.1 (2023-03-22) 0.3.1 (2023-03-22)
- db: bugfix with migration to version 3 - db: bugfix with migration to version 3
- added info about api_timeout config parameter - added info about api_timeout config parameter
- bugfix with processing of test tasks with new revision - bugfix with processing of test tasks with new revision
0.3.2 (2023-03-23)
- Bugfix ALBS-1060