From 33debfd1ba515c899608b29e6fb31bb2cd524c5c Mon Sep 17 00:00:00 2001 From: Adrian Edwards Date: Mon, 15 Sep 2025 13:11:06 -0400 Subject: [PATCH 1/6] refactor send_messages to remove a almost entirely duplicate code path Signed-off-by: Adrian Edwards --- augur/tasks/util/collection_util.py | 62 ++++++++++++++--------------- 1 file changed, 29 insertions(+), 33 deletions(-) diff --git a/augur/tasks/util/collection_util.py b/augur/tasks/util/collection_util.py index bed73bd120..44effbbf78 100644 --- a/augur/tasks/util/collection_util.py +++ b/augur/tasks/util/collection_util.py @@ -597,37 +597,33 @@ def send_messages(self): for repo_git, full_collection in col_hook.repo_list: repo = get_repo_by_repo_git(repo_git) + platform_name = "github" + # this needs to be here and not up a level since it should be set/reset for each repo. + # otherwise a gitlab repo would reset it and cause subsequent github repos to use gitlab phases. + phases = None if "github" in repo.repo_git: - augur_collection_sequence = [] - for job in col_hook.phases: - #Add the phase to the sequence in order as a celery task. - #The preliminary task creates the larger task chain - augur_collection_sequence.append(job(repo_git, full_collection)) - - #augur_collection_sequence.append(core_task_success_util.si(repo_git)) - #Link all phases in a chain and send to celery - augur_collection_chain = chain(*augur_collection_sequence) - task_id = augur_collection_chain.apply_async().task_id - - self.logger.info(f"Setting github repo {col_hook.name} status to collecting for repo: {repo_git}") - - #yield the value of the task_id to the calling method so that the proper collectionStatus field can be updated - yield repo_git, task_id, col_hook.name - else: - if col_hook.gitlab_phases is not None: - - augur_collection_sequence = [] - for job in col_hook.gitlab_phases: - #Add the phase to the sequence in order as a celery task. - #The preliminary task creates the larger task chain - augur_collection_sequence.append(job(repo_git, full_collection)) - - #augur_collection_sequence.append(core_task_success_util.si(repo_git)) - #Link all phases in a chain and send to celery - augur_collection_chain = chain(*augur_collection_sequence) - task_id = augur_collection_chain.apply_async().task_id - - self.logger.info(f"Setting gitlab repo {col_hook.name} status to collecting for repo: {repo_git}") - - #yield the value of the task_id to the calling method so that the proper collectionStatus field can be updated - yield repo_git, task_id, col_hook.name + phases = col_hook.phases + # use default platform name + + elif "gitlab" in repo.repo_git: + platform_name = "gitlab" + if col_hook.gitlab_phases is None: + return + phases = col_hook.gitlab_phases + + augur_collection_sequence = [] + for job in phases: + #Add the phase to the sequence in order as a celery task. + #The preliminary task creates the larger task chain + augur_collection_sequence.append(job(repo_git, full_collection)) + + #augur_collection_sequence.append(core_task_success_util.si(repo_git)) + #Link all phases in a chain and send to celery + augur_collection_chain = chain(*augur_collection_sequence) + task_id = augur_collection_chain.apply_async().task_id + + self.logger.info(f"Setting {platform_name} repo {col_hook.name} status to collecting for repo: {repo_git}") + + #yield the value of the task_id to the calling method so that the proper collectionStatus field can be updated + yield repo_git, task_id, col_hook.name + From 83d0db1c76d4837d1fde84750692595d3a15c4e1 Mon Sep 17 00:00:00 2001 From: Adrian Edwards Date: Mon, 15 Sep 2025 16:37:03 -0400 Subject: [PATCH 2/6] refactor facade_phase to return the group itself so that celery can properly convert things into a chord Signed-off-by: Adrian Edwards --- augur/tasks/git/facade_tasks.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/augur/tasks/git/facade_tasks.py b/augur/tasks/git/facade_tasks.py index ce03524e0f..15537a4d1a 100644 --- a/augur/tasks/git/facade_tasks.py +++ b/augur/tasks/git/facade_tasks.py @@ -491,7 +491,6 @@ def facade_phase(repo_git, full_collection): #force_analysis = session.force_analysis run_facade_contributors = facade_helper.run_facade_contributors - facade_sequence = [] facade_core_collection = [] if not limited_run or (limited_run and pull_repos): @@ -509,14 +508,12 @@ def facade_phase(repo_git, full_collection): #These tasks need repos to be cloned by facade before they can work. - facade_sequence.append( - group( - chain(*facade_core_collection), - process_dependency_metrics.si(repo_git), - process_libyear_dependency_metrics.si(repo_git), - process_scc_value_metrics.si(repo_git) - ) + facade_sequence = group( + chain(*facade_core_collection), + process_dependency_metrics.si(repo_git), + process_libyear_dependency_metrics.si(repo_git), + process_scc_value_metrics.si(repo_git) ) logger.info(f"Facade sequence: {facade_sequence}") - return chain(*facade_sequence) \ No newline at end of file + return facade_sequence \ No newline at end of file From bc35b3802538656d451c0a4b6cdd017e1e550073 Mon Sep 17 00:00:00 2001 From: Sajal-Kulshreshtha Date: Tue, 9 Sep 2025 20:05:11 +0530 Subject: [PATCH 3/6] fix(cli): display timezone in output for GitHub key expiry (#3251) Signed-off-by: Sajal-Kulshreshtha --- augur/application/cli/github.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/augur/application/cli/github.py b/augur/application/cli/github.py index 4896bf05fb..bcc29597b6 100644 --- a/augur/application/cli/github.py +++ b/augur/application/cli/github.py @@ -88,9 +88,12 @@ def update_api_key(): engine.dispose() + + def epoch_to_local_time_with_am_pm(epoch): - local_time = datetime.fromtimestamp(epoch) - formatted_time = local_time.strftime('%I:%M %p') # This format includes the date as well + # Convert epoch to local time with timezone awareness + local_time = datetime.fromtimestamp(epoch).astimezone() + formatted_time = local_time.strftime('%Y-%m-%d %I:%M %p %Z (UTC%z)') return formatted_time From 60d3036d8d6b8b54d5f3668c892955fde60f190a Mon Sep 17 00:00:00 2001 From: Sajal-Kulshreshtha Date: Fri, 12 Sep 2025 03:15:36 +0530 Subject: [PATCH 4/6] removed day from formatted time Signed-off-by: Sajal-Kulshreshtha --- augur/application/cli/github.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/augur/application/cli/github.py b/augur/application/cli/github.py index bcc29597b6..6dfca0f7d5 100644 --- a/augur/application/cli/github.py +++ b/augur/application/cli/github.py @@ -93,7 +93,7 @@ def update_api_key(): def epoch_to_local_time_with_am_pm(epoch): # Convert epoch to local time with timezone awareness local_time = datetime.fromtimestamp(epoch).astimezone() - formatted_time = local_time.strftime('%Y-%m-%d %I:%M %p %Z (UTC%z)') + formatted_time = local_time.strftime('%I:%M %p %Z (UTC%z)') return formatted_time From 259869925d161c94881f921230d0d2f599596058 Mon Sep 17 00:00:00 2001 From: Sajal-Kulshreshtha Date: Tue, 16 Sep 2025 02:27:21 +0530 Subject: [PATCH 5/6] removed extra lines Signed-off-by: Sajal-Kulshreshtha --- augur/application/cli/github.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/augur/application/cli/github.py b/augur/application/cli/github.py index 6dfca0f7d5..8716a1f623 100644 --- a/augur/application/cli/github.py +++ b/augur/application/cli/github.py @@ -87,16 +87,12 @@ def update_api_key(): engine.dispose() - - - def epoch_to_local_time_with_am_pm(epoch): # Convert epoch to local time with timezone awareness local_time = datetime.fromtimestamp(epoch).astimezone() formatted_time = local_time.strftime('%I:%M %p %Z (UTC%z)') return formatted_time - def find_duplicates(lst): counter = Counter(lst) return [item for item, count in counter.items() if count > 1] From 139d5bcc326210ab3f61e6dd94e6cc7f45d1b556 Mon Sep 17 00:00:00 2001 From: Sajal-Kulshreshtha Date: Tue, 16 Sep 2025 20:25:51 +0530 Subject: [PATCH 6/6] Align timestamp formatting with header layout Signed-off-by: Sajal-Kulshreshtha --- augur/application/cli/github.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/augur/application/cli/github.py b/augur/application/cli/github.py index 8716a1f623..0fa1f2967c 100644 --- a/augur/application/cli/github.py +++ b/augur/application/cli/github.py @@ -56,7 +56,7 @@ def update_api_key(): core_reset_header = "Core Reset Time" graphql_request_header = "Graphql Requests Left" graphql_reset_header = "Graphql Reset Time" - print(f"{'Key'.center(40)} {core_request_header} {core_reset_header} {graphql_request_header} {graphql_reset_header}") + print(f"{'Key'.center(40)} {core_request_header} {core_reset_header.center(24)} {graphql_request_header} {graphql_reset_header.center(24)}") for key, core_key_data, graphql_key_data in valid_key_data: core_requests = str(core_key_data['requests_remaining']).center(len(core_request_header)) core_reset_time = str(epoch_to_local_time_with_am_pm(core_key_data["reset_epoch"])).center(len(core_reset_header)) @@ -90,7 +90,7 @@ def update_api_key(): def epoch_to_local_time_with_am_pm(epoch): # Convert epoch to local time with timezone awareness local_time = datetime.fromtimestamp(epoch).astimezone() - formatted_time = local_time.strftime('%I:%M %p %Z (UTC%z)') + formatted_time = local_time.strftime('%I:%M %p %Z (UTC%z)').center(24) return formatted_time def find_duplicates(lst):