Skip to content
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

Release Ready #2903

Merged
merged 104 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
f0c73cd
Merge pull request #2885 from chaoss/docker-dev
sgoggins Aug 11, 2024
f22613c
Set per page to 100
ABrain7710 Aug 19, 2024
8f07cf4
start splitting out event collections into two classes
ABrain7710 Aug 21, 2024
1fd8266
define thorough event collection
ABrain7710 Aug 25, 2024
c15dd09
remove old implementation and clean up some things
ABrain7710 Aug 25, 2024
a3169b0
pass params
ABrain7710 Aug 26, 2024
d7c093a
call correct method name
ABrain7710 Aug 26, 2024
36ad632
other syntax fixes
ABrain7710 Aug 26, 2024
347a2e2
only log not mappable events when there are some
ABrain7710 Aug 26, 2024
b45b37f
only add non null contributors
ABrain7710 Aug 26, 2024
7f41d24
Merge branch 'dev' into dev-fixes
sgoggins Aug 27, 2024
2b5ce1a
fix: add url not found catching
ABrain7710 Aug 27, 2024
9d65e24
Merge pull request #2897 from chaoss/dev-fixes
sgoggins Aug 27, 2024
36ae56c
Pull relevant mods from admin-changes
Ulincsys Jul 15, 2024
f0e27a3
initial work on jumpstart project
Ulincsys Jul 15, 2024
709e771
Implement decoding and blocking
Ulincsys Jul 15, 2024
d7c6a87
add TUI, expand server basis
Ulincsys Jul 22, 2024
3bac827
update encoding
Ulincsys Jul 23, 2024
cf6c9ec
continue work on concurrency
Ulincsys Jul 30, 2024
121ee03
mvp
Ulincsys Aug 12, 2024
761cc50
Fix improper client shutdown on some platforms
Ulincsys Aug 12, 2024
e920890
Add DB check before parsing start command
Ulincsys Aug 27, 2024
2067d44
Add github graphql data access'
ABrain7710 Jul 3, 2024
140ea06
Improve paginate_resource logic
ABrain7710 Jul 4, 2024
5577ce0
Remove unused method
ABrain7710 Jul 4, 2024
06d2c06
Move repo_info to new graphql endpoint
ABrain7710 Jul 13, 2024
fde0ec4
Migrate pr files to github_graphql_data_access
ABrain7710 Jul 13, 2024
06bc536
Indent client'
ABrain7710 Jul 13, 2024
2e05618
Remove strip
ABrain7710 Jul 13, 2024
ec71977
Define keys as list
ABrain7710 Jul 13, 2024
034333e
Return data properly
ABrain7710 Jul 13, 2024
93577d7
Add self
ABrain7710 Jul 15, 2024
078bc8a
Fix syntax error
ABrain7710 Jul 15, 2024
358b146
Fix syntax error
ABrain7710 Jul 15, 2024
a96b380
Fixes
ABrain7710 Jul 15, 2024
97af39b
Raise from original exception
ABrain7710 Jul 15, 2024
ecb7b57
Make annoying info log a debug
ABrain7710 Jul 15, 2024
46438df
updating version
sgoggins Jul 17, 2024
f3cb92a
Address release bugs
ABrain7710 Jul 22, 2024
3b3f42a
Raise exceptions on graphql errors
ABrain7710 Jul 22, 2024
cbdcfff
Remove comment
ABrain7710 Jul 23, 2024
e208c03
Fix syntax error
ABrain7710 Jul 23, 2024
afd7c18
Catch not found for prs
ABrain7710 Jul 23, 2024
42e7ad8
Throw exception when data is none
ABrain7710 Jul 23, 2024
84b97f4
try this
ABrain7710 Jul 23, 2024
44da383
Add variables
ABrain7710 Jul 23, 2024
4b368e4
Handle case where api returns None
ABrain7710 Jul 23, 2024
a5081be
collection tweak
sgoggins Aug 5, 2024
49f1f5b
update to collection
sgoggins Aug 5, 2024
50f2909
updated docker schema
sgoggins Aug 5, 2024
bb5f8fe
update docker config
sgoggins Aug 5, 2024
7b40f5c
docker updates
sgoggins Aug 5, 2024
4030daa
got GeckoDriver running in Docker
sgoggins Aug 6, 2024
95862a6
path update to docker file
sgoggins Aug 6, 2024
00d990b
dockerfile update
sgoggins Aug 6, 2024
5b24a31
still fidling with chromedriver or geckodriver in docker
sgoggins Aug 6, 2024
f9adbb1
update with new webdriver approach
sgoggins Aug 6, 2024
8143071
still sorting out image generation
sgoggins Aug 6, 2024
3d4ca05
Remove github paginator
ABrain7710 Jul 24, 2024
94744e9
Remove github paginator
ABrain7710 Jul 24, 2024
b9690cc
Add back check
ABrain7710 Jul 24, 2024
bfdfbe3
Fix syntax error
ABrain7710 Jul 24, 2024
f89cb94
Fix pylint errors
ABrain7710 Jul 24, 2024
15b70d5
add commit message to commit message table
IsaacMilarky Jul 23, 2024
283d255
ready for alembic fixes
IsaacMilarky Jul 23, 2024
f98e49f
add commit message table to alembic scripts
IsaacMilarky Jul 25, 2024
8fb6efd
bulk insert commit message data
IsaacMilarky Jul 25, 2024
0b98e36
linting
IsaacMilarky Aug 5, 2024
ee0507a
syntax
IsaacMilarky Aug 5, 2024
8853adb
Remove exception handler and improve logging
ABrain7710 Jul 4, 2024
3b8a475
Fully collect github events
ABrain7710 Jul 4, 2024
2c9216e
Add warning so we can detect if the last page link is not in headers …
ABrain7710 Jul 4, 2024
455f847
Fix indentation
ABrain7710 Jul 13, 2024
902ec6f
Fix boolean logic
ABrain7710 Aug 5, 2024
51901ac
Fix string
ABrain7710 Aug 5, 2024
e4a0a3e
bug fix for events
sgoggins Aug 7, 2024
cf99b23
Handle url not found in contributor breadth worker
ABrain7710 Aug 7, 2024
44b1c62
docker fun
sgoggins Aug 8, 2024
456b0f5
failed docker config
sgoggins Aug 8, 2024
07c2c38
saving failed config
sgoggins Aug 8, 2024
f0cad14
Docker compose script now workinggit add docker/
sgoggins Aug 8, 2024
6a6ba73
removed old file
sgoggins Aug 8, 2024
56808aa
debugging a couple errors. One with a missing import, the other tryin…
sgoggins Aug 10, 2024
ca0d4b2
possible fix for commit messages
sgoggins Aug 11, 2024
f512443
changed page_count > 300 to a warning instead of an exception
sgoggins Aug 11, 2024
457b03d
updated unterminated string error
sgoggins Aug 11, 2024
d7d435b
Fixing NPM
sgoggins Aug 12, 2024
21660e1
events page count seems to top out at 1,000, not 300
sgoggins Aug 12, 2024
e665aec
update to events to use correct column name
sgoggins Aug 12, 2024
b80a480
update to augur event collection
sgoggins Aug 12, 2024
c35f449
logging event so we know what's supposed to be there
sgoggins Aug 12, 2024
a9830ea
Looking at event logs, it appears that issue is not always contained …
sgoggins Aug 14, 2024
de320b2
fixing pickling error caused by not consistently importing our Metada…
sgoggins Aug 14, 2024
dbdb7e3
additional update for when issue is not an object in an event respons…
sgoggins Aug 14, 2024
4c45d8f
Trying to fix issue when the committer count API returns no value on …
sgoggins Aug 14, 2024
ed50be2
exception handling
sgoggins Aug 14, 2024
f510da4
trying to fix the empty committer count issue
sgoggins Aug 14, 2024
82b9159
added some comments explaining the query_committers_count method changes
sgoggins Aug 14, 2024
8967212
Making repo GONE log message more clear.
sgoggins Aug 14, 2024
5705644
Working to get more information on this error:
sgoggins Aug 14, 2024
97fee7e
formatting exception for OpenSSF Scorecard pickling error more typically
sgoggins Aug 14, 2024
ebca962
fix for missing comma, fix misspelling
Ulincsys Aug 27, 2024
491b688
Merge branch 'dev' into jumpstart
sgoggins Aug 27, 2024
aae2f19
Merge pull request #2902 from chaoss/jumpstart
sgoggins Aug 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ augur_export_env.sh
config.yml
reports.yml
*.pid
*.sock

node_modules/
.idea/
Expand Down
2 changes: 1 addition & 1 deletion augur/api/view/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@ def write_settings(current_settings):
# Initialize logging
def init_logging():
global logger
logger = AugurLogger("augur_view", reset_logfiles=True).get_logger()
logger = AugurLogger("augur_view", reset_logfiles=False).get_logger()
4 changes: 2 additions & 2 deletions augur/application/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def new_func(ctx, *args, **kwargs):
You are not connected to the internet.\n \
Please connect to the internet to run Augur\n \
Consider setting http_proxy variables for limited access installations.")
sys.exit()
sys.exit(-1)

return update_wrapper(new_func, function_internet_connection)

Expand Down Expand Up @@ -78,7 +78,7 @@ def new_func(ctx, *args, **kwargs):
print(f"\n\n{usage} command setup failed\nERROR: connecting to database\nHINT: The {incorrect_values} may be incorrectly specified in {location}\n")

engine.dispose()
sys.exit()
sys.exit(-2)

return update_wrapper(new_func, function_db_connection)

Expand Down
1 change: 0 additions & 1 deletion augur/application/cli/_multicommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def get_command(self, ctx, name):

# Check that the command exists before importing
if not cmdfile.is_file():

return

# Prefer to raise exception instead of silcencing it
Expand Down
9 changes: 5 additions & 4 deletions augur/application/cli/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@

from augur.application.db.session import DatabaseSession
from augur.application.logs import AugurLogger
from augur.application.cli import test_connection, test_db_connection, with_database
from augur.application.cli import test_connection, test_db_connection, with_database, DatabaseContext
from augur.application.cli._cli_util import _broadcast_signal_to_processes, raise_open_file_limit, clear_redis_caches, clear_rabbitmq_messages
from augur.application.db.lib import get_value

logger = AugurLogger("augur", reset_logfiles=True).get_logger()
logger = AugurLogger("augur", reset_logfiles=False).get_logger()

@click.group('api', short_help='Commands for controlling the backend API server')
def cli():
pass
@click.pass_context
def cli(ctx):
ctx.obj = DatabaseContext()

@cli.command("start")
@click.option("--development", is_flag=True, default=False, help="Enable development mode")
Expand Down
65 changes: 61 additions & 4 deletions augur/application/cli/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def cli(ctx):
@click.pass_context
def start(ctx, disable_collection, development, pidfile, port):
"""Start Augur's backend server."""
with open(pidfile, "w") as pidfile:
pidfile.write(str(os.getpid()))
with open(pidfile, "w") as pidfile_io:
pidfile_io.write(str(os.getpid()))

try:
if os.environ.get('AUGUR_DOCKER_DEPLOY') != "1":
Expand All @@ -63,6 +63,8 @@ def start(ctx, disable_collection, development, pidfile, port):
if development:
os.environ["AUGUR_DEV"] = "1"
logger.info("Starting in development mode")

os.environ["AUGUR_PIDFILE"] = pidfile

try:
gunicorn_location = os.getcwd() + "/augur/api/gunicorn_conf.py"
Expand All @@ -74,6 +76,11 @@ def start(ctx, disable_collection, development, pidfile, port):
if not port:
port = get_value("Server", "port")

os.environ["AUGUR_PORT"] = str(port)

if disable_collection:
os.environ["AUGUR_DISABLE_COLLECTION"] = "1"

worker_vmem_cap = get_value("Celery", 'worker_process_vmem_cap')

gunicorn_command = f"gunicorn -c {gunicorn_location} -b {host}:{port} augur.api.server:app --log-file gunicorn.log"
Expand Down Expand Up @@ -128,7 +135,7 @@ def start(ctx, disable_collection, development, pidfile, port):
augur_collection_monitor.si().apply_async()

else:
logger.info("Collection disabled")
logger.info("Collection disabled")

try:
server.wait()
Expand All @@ -153,6 +160,8 @@ def start(ctx, disable_collection, development, pidfile, port):
cleanup_after_collection_halt(logger, ctx.obj.engine)
except RedisConnectionError:
pass

os.unlink(pidfile)

def start_celery_worker_processes(vmem_cap_ratio, disable_collection=False):

Expand Down Expand Up @@ -224,6 +233,54 @@ def stop(ctx):

augur_stop(signal.SIGTERM, logger, ctx.obj.engine)

@cli.command('stop-collection-blocking')
@test_connection
@test_db_connection
@with_database
@click.pass_context
def stop_collection(ctx):
"""
Stop collection tasks if they are running, block until complete
"""
processes = get_augur_processes()

stopped = []

p: psutil.Process
for p in processes:
if p.name() == "celery":
stopped.append(p)
p.terminate()

if not len(stopped):
logger.info("No collection processes found")
return

_, alive = psutil.wait_procs(stopped, 5,
lambda p: logger.info(f"STOPPED: {p.pid}"))

killed = []
while True:
for i in range(len(alive)):
if alive[i].status() == psutil.STATUS_ZOMBIE:
logger.info(f"KILLING ZOMBIE: {alive[i].pid}")
alive[i].kill()
killed.append(i)
elif not alive[i].is_running():
logger.info(f"STOPPED: {p.pid}")
killed.append(i)

for i in reversed(killed):
alive.pop(i)

if not len(alive):
break

logger.info(f"Waiting on [{', '.join(str(p.pid for p in alive))}]")
time.sleep(0.5)

cleanup_after_collection_halt(logger, ctx.obj.engine)

@cli.command('kill')
@test_connection
@test_db_connection
Expand Down Expand Up @@ -388,7 +445,7 @@ def processes():
Outputs the name/PID of all Augur server & worker processes"""
augur_processes = get_augur_processes()
for process in augur_processes:
logger.info(f"Found process {process.pid}")
logger.info(f"Found process {process.pid} [{process.name()}] -> Parent: {process.parent().pid}")

def get_augur_processes():
augur_processes = []
Expand Down
9 changes: 5 additions & 4 deletions augur/application/cli/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@
from augur.application.db.session import DatabaseSession
from augur.application.logs import AugurLogger
from augur.application.db.lib import get_value
from augur.application.cli import test_connection, test_db_connection, with_database
from augur.application.cli import test_connection, test_db_connection, with_database, DatabaseContext
from augur.application.cli._cli_util import _broadcast_signal_to_processes, raise_open_file_limit, clear_redis_caches, clear_rabbitmq_messages

logger = AugurLogger("augur", reset_logfiles=True).get_logger()
logger = AugurLogger("augur", reset_logfiles=False).get_logger()

@click.group('server', short_help='Commands for controlling the backend API server & data collection workers')
def cli():
pass
@click.pass_context
def cli(ctx):
ctx.obj = DatabaseContext()

@cli.command("start")
@click.option("--development", is_flag=True, default=False, help="Enable development mode, implies --disable-collection")
Expand Down
98 changes: 98 additions & 0 deletions augur/application/cli/jumpstart.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import psutil
import click
import time
import subprocess
from pathlib import Path
from datetime import datetime

@click.group(invoke_without_command=True)
@click.pass_context
def cli(ctx):
if ctx.invoked_subcommand is None:
p = check_running()
if not p:
click.echo("Jumpstart is not running. Start it with: augur jumpstart run")
return

click.echo(f"Connecting to Jumpstart: [{p.pid}]")

while p.is_running() and not len(p.connections("unix")):
# Waiting for app to open fd socket
time.sleep(0.1)

if not p.is_running():
click.echo("Error: Jumpstart server exited abnormally")
return

from jumpstart.tui import run_app
run_app(ctx=ctx)

def check_running(pidfile = ".jumpstart.pid") -> psutil.Process:
jumpidf = Path(pidfile)

try:
jumpid, create_time = jumpidf.read_text().splitlines()
jumpp = psutil.Process(int(jumpid))

if create_time != str(jumpp.create_time()):
# PID was reused, not the original
jumpidf.unlink()
return

return jumpp
except (psutil.NoSuchProcess, FileNotFoundError):
return
except PermissionError:
click.echo(f"Permission denied while reading from or writing to pidfile [{str(jumpidf.resolve())}]")

@cli.command("status")
def get_status():
p = check_running()

if not p:
click.echo("Jumpstart is not running")
else:
since = datetime.fromtimestamp(p.create_time()).astimezone()
delta = datetime.now().astimezone() - since
click.echo(f"Jumpstart is running at: [{p.pid}] since {since.strftime('%a %b %d, %Y %H:%M:%S %z:%Z')} [{delta}]")

@cli.command("run")
@click.pass_context
def startup(ctx):
p = check_running()

if not p:
click.echo("Starting")
p = launch(ctx)
else:
click.echo(f"Jumpstart is already running [{p.pid}]")

@cli.command("processID")
def get_main_ID():
p = check_running()

if p:
click.echo(p.pid)

@cli.command("shutdown")
def shutdown_server():
p = check_running()

if not p:
click.echo("Jumpstart is not running")
return

click.echo("Blocking on shutdown")
p.terminate()
p.wait()

def launch(ctx, pidfile = ".jumpstart.pid", socketfile = "jumpstart.sock"):
service = subprocess.Popen(f"python -m jumpstart.jumpstart pidfile={pidfile} socketfile={socketfile}".split())

# Popen object does not have create_time for some reason
ext_process = psutil.Process(service.pid)

with open(pidfile, "w") as file:
file.write(f"{ext_process.pid}\n{ext_process.create_time()}")

return ext_process
2 changes: 1 addition & 1 deletion augur/application/cli/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
from augur.application.cli import test_connection, test_db_connection
from augur.application.cli.backend import clear_rabbitmq_messages, raise_open_file_limit

logger = AugurLogger("augur", reset_logfiles=True).get_logger()
logger = AugurLogger("augur", reset_logfiles=False).get_logger()

@click.group('celery', short_help='Commands for controlling the backend API server & data collection workers')
def cli():
Expand Down
6 changes: 3 additions & 3 deletions augur/application/db/data_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,21 +283,21 @@ def extract_pr_review_message_ref_data(comment: dict, augur_pr_review_id, github
return pr_review_comment_message_ref


def extract_pr_event_data(event: dict, pr_id: int, platform_id: int, repo_id: int, tool_source: str, tool_version: str, data_source: str) -> dict:
def extract_pr_event_data(event: dict, pr_id: int, gh_src_id: int, platform_id: int, repo_id: int, tool_source: str, tool_version: str, data_source: str) -> dict:

pr_event = {
'pull_request_id': pr_id,
'cntrb_id': event["cntrb_id"] if "cntrb_id" in event else None,
'action': event['event'],
'action_commit_hash': None,
'created_at': event['created_at'],
'issue_event_src_id': int(event['issue']["id"]),
'issue_event_src_id': gh_src_id,
'node_id': event['node_id'],
'node_url': event['url'],
'tool_source': tool_source,
'tool_version': tool_version,
'data_source': data_source,
'pr_platform_event_id': int(event['issue']["id"]),
'pr_platform_event_id': gh_src_id,
'platform_id': platform_id,
'repo_id': repo_id
}
Expand Down
Loading
Loading