Skip to content

Fixing Facade Error on commit counting #3123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft

Fixing Facade Error on commit counting #3123

wants to merge 20 commits into from

Conversation

sgoggins
Copy link
Member

@sgoggins sgoggins commented Apr 8, 2025

Description

  • Various flavors of this error occur if there is any issue with the commit history:
Traceback (most recent call last):
  File "/home/sean/github/virtualenv/ai/lib/python3.11/site-packages/celery/app/trace.py", line 451, in trace_task
    R = retval = fun(*args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^
  File "/home/sean/github/virtualenv/ai/lib/python3.11/site-packages/celery/app/trace.py", line 734, in __protected_call__
    return self.run(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sean/github/ai.chaoss/augur/tasks/git/facade_tasks.py", line 366, in git_update_commit_count_weight
    commit_count = get_repo_commit_count(logger, facade_helper, repo_git)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sean/github/ai.chaoss/augur/tasks/git/util/facade_worker/facade_worker/utilitymethods.py", line 169, in get_repo_commit_count
    raise e
  File "/home/sean/github/ai.chaoss/augur/tasks/git/util/facade_worker/facade_worker/utilitymethods.py", line 164, in get_repo_commit_count
    check_commit_count_cmd = check_output(
                             ^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['git', '--git-dir', '/mnt/external/ai-repos/mnt/repos/repos/hostedaugur/hosted/139113-github.com-spring-projects-spring-data-commons/spring-data-commons/.git', 'rev-list', '--count', 'HEAD']' returned non-zero exit status 128.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/sean/github/virtualenv/ai/lib/python3.11/site-packages/celery/backends/redis.py", line 520, in on_chord_part_return
    resl = [unpack(tup, decode) for tup in resl]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sean/github/virtualenv/ai/lib/python3.11/site-packages/celery/backends/redis.py", line 520, in <listcomp>
    resl = [unpack(tup, decode) for tup in resl]
            ^^^^^^^^^^^^^^^^^^^
  File "/home/sean/github/virtualenv/ai/lib/python3.11/site-packages/celery/backends/redis.py", line 426, in _unpack_chord_result
    raise ChordError(f'Dependency {tid} raised {retval!r}')
celery.exceptions.ChordError: Dependency 123fb7d4-2b7d-4ad7-975c-17379f9d1e89 raised CalledProcessError(128, ['git', '--git-dir', '/mnt/external/ai-repos/mnt/repos/repos/hostedaugur/hosted/139113-github.com-spring-projects-spring-data-commons/spring-data-commons/.git', 'rev-list', '--count', 'HEAD'])

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/sean/github/virtualenv/ai/lib/python3.11/site-packages/celery/app/trace.py", line 468, in trace_task
    I, R, state, retval = on_error(task_request, exc, uuid)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sean/github/virtualenv/ai/lib/python3.11/site-packages/celery/app/trace.py", line 379, in on_error
    R = I.handle_error_state(
        ^^^^^^^^^^^^^^^^^^^^^
  File "/home/sean/github/virtualenv/ai/lib/python3.11/site-packages/celery/app/trace.py", line 178, in handle_error_state
    return {
           ^
  File "/home/sean/github/virtualenv/ai/lib/python3.11/site-packages/celery/app/trace.py", line 225, in handle_failure
    task.backend.mark_as_failure(
  File "/home/sean/github/virtualenv/ai/lib/python3.11/site-packages/celery/backends/base.py", line 217, in mark_as_failure
    self.on_chord_part_return(chain_elem_ctx, state, exc)
  File "/home/sean/github/virtualenv/ai/lib/python3.11/site-packages/celery/backends/redis.py", line 539, in on_chord_part_return
    return self.chord_error_from_stack(callback, exc)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sean/github/virtualenv/ai/lib/python3.11/site-packages/celery/backends/base.py", line 309, in chord_error_from_stack
    return backend.fail_from_current_stack(callback.id, exc=exc)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sean/github/virtualenv/ai/lib/python3.11/site-packages/celery/backends/base.py", line 316, in fail_from_current_stack
    self.mark_as_failure(task_id, exc, exception_info.traceback)
  File "/home/sean/github/virtualenv/ai/lib/python3.11/site-packages/celery/backends/base.py", line 172, in mark_as_failure
    self.store_result(task_id, exc, state,
  File "/home/sean/github/virtualenv/ai/lib/python3.11/site-packages/celery/backends/base.py", line 528, in store_result
    self._store_result(task_id, result, state, traceback,
  File "/home/sean/github/virtualenv/ai/lib/python3.11/site-packages/celery/backends/base.py", line 956, in _store_result
    current_meta = self._get_task_meta_for(task_id)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sean/github/virtualenv/ai/lib/python3.11/site-packages/celery/backends/base.py", line 978, in _get_task_meta_for
    meta = self.get(self.get_key_for_task(task_id))
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/sean/github/virtualenv/ai/lib/python3.11/site-packages/celery/backends/base.py", line 856, in get_key_for_task
    return key_t('').join([
           ^^^^^^^^^^^^^^^^
TypeError: sequence item 1: expected a bytes-like object, NoneType found

This PR fixes that issue.

sgoggins added 5 commits April 8, 2025 09:20
Signed-off-by: Sean P. Goggins <s@goggins.com>
Signed-off-by: Sean P. Goggins <s@goggins.com>
Signed-off-by: Sean P. Goggins <s@goggins.com>
Signed-off-by: Sean P. Goggins <s@goggins.com>
Signed-off-by: Sean P. Goggins <s@goggins.com>
@sgoggins sgoggins requested review from ABrain7710 and Copilot April 8, 2025 15:22
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

augur/tasks/git/util/facade_worker/facade_worker/utilitymethods.py:192

  • The new implementation of get_repo_commit_count is being commented out, leaving an older version active. Consider removing the old, commented-out code to avoid potential confusion and ensure that the intended improvements are actually in effect.
"""

@sgoggins sgoggins added server Related to the Augur server workers Related to data workers bug-fix Fixes a bug python Pull requests that update Python code labels Apr 8, 2025
Signed-off-by: Sean P. Goggins <s@goggins.com>
@sgoggins sgoggins requested a review from Copilot April 8, 2025 15:28
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

sgoggins added 2 commits April 8, 2025 10:43
Signed-off-by: Sean P. Goggins <s@goggins.com>
Signed-off-by: Sean P. Goggins <s@goggins.com>
@sgoggins
Copy link
Member Author

sgoggins commented Apr 8, 2025

Latest update is fixing some issues and the task is usually succeeding:

(ai) sean@linda:~/github/ai.chaoss$ cat nohup.out | grep "Retry of 'git rev-list --count HEAD' failed" | wc -l
58
(ai) sean@linda:~/github/ai.chaoss$ cat nohup.out | grep "Error running 'git fsck':" | wc -l
65

sgoggins added 2 commits April 8, 2025 11:15
Signed-off-by: Sean P. Goggins <s@goggins.com>
Signed-off-by: Sean P. Goggins <s@goggins.com>
@sgoggins sgoggins requested a review from Copilot April 8, 2025 16:31
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

"invalid index-pack" errors.
"""
pack_dir = os.path.join(repo_loc, "objects", "pack")
pack_files = glob(os.path.join(pack_dir, "pack-*.pack"))
Copy link
Preview

Copilot AI Apr 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure that the glob module is imported to avoid runtime errors in the remove_corrupted_pack_files function.

Copilot uses AI. Check for mistakes.

f"Retry of git rev-list failed in {repo_loc} with return code "
f"{retry_error.returncode}: {retry_stderr}"
)
return 0
Copy link
Preview

Copilot AI Apr 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning 0 on retry failure may mask underlying repository issues; consider propagating the error instead for clearer error handling.

Suggested change
return 0
raise retry_error

Copilot uses AI. Check for mistakes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A reasonable point. investigating the issues logged here right now.

sgoggins added 2 commits April 8, 2025 11:38
Signed-off-by: Sean P. Goggins <s@goggins.com>
Signed-off-by: Sean P. Goggins <s@goggins.com>
@sgoggins sgoggins requested a review from Copilot April 8, 2025 20:06
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

# For other return codes, re-raise the error.
raise initial_error

except Exception as e:
Copy link
Preview

Copilot AI Apr 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Catching a broad Exception may mask specific error conditions. It is recommended to catch more specific exceptions to handle unexpected errors more accurately.

Suggested change
except Exception as e:
except (OSError, ValueError) as e:

Copilot uses AI. Check for mistakes.

Signed-off-by: Sean P. Goggins <s@goggins.com>
@sgoggins sgoggins requested a review from Copilot April 8, 2025 21:21
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

Comments suppressed due to low confidence (1)

augur/tasks/git/util/facade_worker/facade_worker/_old_method.py:1

  • [nitpick] The entire file is commented out legacy code. If it’s no longer needed, consider removing it to prevent confusion and reduce maintenance overhead.
'''

Comment on lines +147 to +148
pack_files = glob(os.path.join(pack_dir, "pack-*.pack"))
idx_files = glob(os.path.join(pack_dir, "pack-*.idx"))
Copy link
Preview

Copilot AI Apr 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, use 'glob.glob' instead of 'glob' to correctly obtain the index files.

Suggested change
pack_files = glob(os.path.join(pack_dir, "pack-*.pack"))
idx_files = glob(os.path.join(pack_dir, "pack-*.idx"))
pack_files = glob.glob(os.path.join(pack_dir, "pack-*.pack"))
idx_files = glob.glob(os.path.join(pack_dir, "pack-*.idx"))

Copilot uses AI. Check for mistakes.

@sgoggins sgoggins requested a review from Copilot April 8, 2025 21:25
Signed-off-by: Sean P. Goggins <s@goggins.com>
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

augur/tasks/git/util/facade_worker/facade_worker/utilitymethods.py:147

  • The glob function is being used directly despite importing the entire 'glob' module. To avoid runtime errors, either import the glob function using 'from glob import glob' or call it with the module reference as 'glob.glob(...)'.
pack_files = glob(os.path.join(pack_dir, "pack-*.pack"))

@sgoggins sgoggins requested a review from Copilot April 8, 2025 21:26
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

remove_corrupted_pack_files(repo_loc, logger)

# If the error message indicates a bad remote reference, attempt to fix it.
bad_ref = "refs/remotes/origin/dependabot/docker/test/IntegrationTests/docker/postgres-16.4"
Copy link
Preview

Copilot AI Apr 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bad_ref value is hard-coded. Consider making this value configurable or documenting why this specific reference is targeted to ensure future maintainability.

Suggested change
bad_ref = "refs/remotes/origin/dependabot/docker/test/IntegrationTests/docker/postgres-16.4"
bad_ref = get_bad_ref()

Copilot uses AI. Check for mistakes.

…s.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Sean P. Goggins <s@goggins.com>
@sgoggins sgoggins requested a review from Copilot April 8, 2025 21:27
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

augur/tasks/git/util/facade_worker/facade_worker/utilitymethods.py:230

  • Ensure that 'check_output' and 'CalledProcessError' are explicitly imported from the subprocess module to avoid runtime errors if they are not imported elsewhere.
output = check_output(

augur/tasks/git/util/facade_worker/facade_worker/_old_method.py:1

  • [nitpick] Consider removing or archiving this legacy _old_method file if it is no longer needed to reduce code clutter and maintenance overhead.
'''

sgoggins and others added 5 commits April 8, 2025 16:37
Signed-off-by: Sean P. Goggins <s@goggins.com>
Signed-off-by: Sean P. Goggins <s@goggins.com>
Signed-off-by: Sean P. Goggins <s@goggins.com>
Signed-off-by: Sean Goggins <outdoors@acm.org>
Signed-off-by: Sean Goggins <outdoors@acm.org>
@sgoggins sgoggins marked this pull request as draft April 30, 2025 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-fix Fixes a bug python Pull requests that update Python code server Related to the Augur server workers Related to data workers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant