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

Update a copy of the ML patch with augur-new-dev #1996

Merged
merged 197 commits into from
Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
197 commits
Select commit Hold shift + click to select a range
6474189
Validate user endpoint added
Priya730 Aug 15, 2022
c5a7d1d
Create user endpoint added
Priya730 Aug 15, 2022
23a0cf3
Remove user endpoint added
Priya730 Aug 15, 2022
a963406
Update user added
Priya730 Aug 15, 2022
3df73c3
More docs for facade and AugurRoutine
IsaacMilarky Aug 18, 2022
ec22d82
cfg typo
IsaacMilarky Aug 18, 2022
f080d32
facade config doc string
IsaacMilarky Aug 18, 2022
4e8f123
start to adapt release worker
IsaacMilarky Aug 19, 2022
92583f8
Uncomment facade
ABrain7710 Aug 19, 2022
13d4752
release worker functionality has now been cannibalized
IsaacMilarky Aug 19, 2022
5fe3642
Merge branch 'augur-new-release-worker' into augur-new
IsaacMilarky Aug 19, 2022
37f8bce
fix docstring format
IsaacMilarky Aug 19, 2022
0a315e8
small conflict
IsaacMilarky Aug 19, 2022
fbd3bf7
translate repo-info worker
IsaacMilarky Aug 19, 2022
eb28cb6
repo-info functionality working now
IsaacMilarky Aug 19, 2022
ca4b4c8
Merge branch 'augur-new-ml-tasks' into augur-new
ABrain7710 Aug 19, 2022
bef0605
Fix merge conflicK
ABrain7710 Aug 19, 2022
a642c6a
Remove unneeded analysis files
ABrain7710 Aug 19, 2022
f8d8372
Fix undefined var error
ABrain7710 Aug 20, 2022
7d9d1d5
Remove contributor_breadth_worker from worker install
ABrain7710 Aug 20, 2022
86690a5
Install script fix
ABrain7710 Aug 20, 2022
557d966
remove user orm
Priya730 Aug 20, 2022
ab67a5c
Add comments showing most recent versions of augur depencies
ABrain7710 Aug 20, 2022
a4c0493
create user orm
Priya730 Aug 21, 2022
ea5e72f
validate user orm
Priya730 Aug 21, 2022
dfcc25a
scikit-image needed
sgoggins Aug 22, 2022
dbe6c0f
Fix my dumb import mistake
ABrain7710 Aug 22, 2022
40d3747
ZZZMerge branch 'augur-new' of https://github.com/chaoss/augur into a…
ABrain7710 Aug 22, 2022
1cfd17d
Fix'
ABrain7710 Aug 22, 2022
927dc33
fixed an ML library issue
sgoggins Aug 22, 2022
f7a4e71
Merge branch 'augur-new' of https://github.com/chaoss/augur into augu…
sgoggins Aug 22, 2022
1838759
A wise software engineer once said, NEVER. EVER. EVER. EVER. Break th…
sgoggins Aug 22, 2022
9f0f0be
Remove machine learning workers until they are completely tested
ABrain7710 Aug 22, 2022
b05bdee
Remove ml
ABrain7710 Aug 22, 2022
3560478
Fix
ABrain7710 Aug 22, 2022
e11d244
Merge pull request #1958 from chaoss/augur-new-fix
ABrain7710 Aug 22, 2022
352176e
Test
ABrain7710 Aug 22, 2022
5f8b35b
Merge branch 'augur-new' of https://github.com/chaoss/augur into augu…
ABrain7710 Aug 22, 2022
7604521
test
ABrain7710 Aug 22, 2022
0e5afb0
More testing
ABrain7710 Aug 22, 2022
581e90f
Make sure all paginator methods don't fail if retrieve data fails
ABrain7710 Aug 23, 2022
2a8e80f
Small paginator changes
ABrain7710 Aug 23, 2022
e51fe68
Add 2 from_github mehtods
ABrain7710 Aug 23, 2022
cc97dda
Add more from_github methods
ABrain7710 Aug 23, 2022
518173b
Add celery purge command
ABrain7710 Aug 23, 2022
303d466
Add redis clear command
ABrain7710 Aug 23, 2022
8e21886
Ask for user approval before removing all tasks
ABrain7710 Aug 24, 2022
2cf9afe
user update orm
Priya730 Aug 24, 2022
7894a56
First issue found
IsaacMilarky Aug 24, 2022
012a483
syntax
IsaacMilarky Aug 24, 2022
0aa45a2
logs and syntax
IsaacMilarky Aug 24, 2022
563447b
Add more from_github methods
ABrain7710 Aug 25, 2022
7c72857
Make stop, kill, and interupt all remove redis cache data
ABrain7710 Aug 25, 2022
19503ab
adding hits of code metric
sgoggins Aug 26, 2022
00c3eb2
Fix syntax error in augur backend kill
ABrain7710 Aug 26, 2022
d90fb33
Add pool restarts
ABrain7710 Aug 26, 2022
c34f68a
Merge pull request #1961 from chaoss/implement-augur-routine
sgoggins Aug 26, 2022
0c2993f
Merge pull request #1959 from chaoss/augur-new-commands
sgoggins Aug 26, 2022
34e06f1
Add missing params
ABrain7710 Aug 26, 2022
64cdd7a
comment out
ABrain7710 Aug 26, 2022
eac5330
Merge pull request #1960 from chaoss/augur-new-andrew
sgoggins Aug 26, 2022
79cdd93
Revert "Implement augur routine"
ABrain7710 Aug 26, 2022
a8160ce
Merge pull request #1963 from chaoss/revert-1961-implement-augur-routine
sgoggins Aug 26, 2022
9159f11
Space out changes
ABrain7710 Aug 27, 2022
470ec7d
Corrected decorator
Priya730 Aug 29, 2022
f54ea80
revert
IsaacMilarky Aug 29, 2022
c557a87
Test
ABrain7710 Aug 30, 2022
d79e9b2
Test
ABrain7710 Aug 30, 2022
8316b03
Update setup.py and small backend.py change
ABrain7710 Aug 30, 2022
c7364c5
Change tasks to work with eventlet
ABrain7710 Aug 30, 2022
a5a7ed4
Change celery.py to celery_handler.py so it doesn't conflict with lib…
ABrain7710 Aug 30, 2022
700c42c
Change redis.py to redis_handler.py so it doesn't conflict with the r…
ABrain7710 Aug 30, 2022
5bd7f8a
Add log statements for potential issue
ABrain7710 Aug 30, 2022
10b74dc
Add repo info task and releases task
ABrain7710 Aug 30, 2022
2963485
Rename celery and redis cli
ABrain7710 Aug 30, 2022
59e18a0
Add @ decorator that was remove by find and replace
ABrain7710 Aug 30, 2022
413c15b
Fix for augur tasks start
ABrain7710 Aug 30, 2022
9aa164c
Test new db conn
ABrain7710 Aug 31, 2022
f197370
Fix syntax error
ABrain7710 Aug 31, 2022
45af868
print headers on secondary rate limit
ABrain7710 Aug 31, 2022
9f9dca9
Log the retry-after header
ABrain7710 Aug 31, 2022
b094a81
Sleep the amount of time that Github says to retry after
ABrain7710 Aug 31, 2022
a0e0d15
Add task rate limit
ABrain7710 Aug 31, 2022
8fe7d16
Up the rate limit to 3 a second
ABrain7710 Aug 31, 2022
f28b8e0
Up the rate limit to 5 a second
ABrain7710 Aug 31, 2022
f33cc5a
Start multiple celery workers instead of one massive one
ABrain7710 Aug 31, 2022
a16076a
Tweak settings
ABrain7710 Aug 31, 2022
07ee1f7
Reduce concurrency
ABrain7710 Aug 31, 2022
a0f633e
write task to update repos when moved
IsaacMilarky Aug 31, 2022
36f3382
detect_github_repo_move done
IsaacMilarky Aug 31, 2022
f59d76c
Rewrite the task routine
IsaacMilarky Aug 31, 2022
6e4e571
Merge branch 'implement-augur-routine' into detect-github-repo-move
IsaacMilarky Aug 31, 2022
1dd68ac
Change passing repo by \'repo_git\' instead use the primary key. This…
IsaacMilarky Aug 31, 2022
c2db575
Test
ABrain7710 Aug 31, 2022
34e385b
Merge pull request #1964 from chaoss/augur-new-api-fix
sgoggins Aug 31, 2022
7ffced9
Fixes to random errors
ABrain7710 Aug 31, 2022
a21c0e1
Check list of keys before returning the redis keys
ABrain7710 Aug 31, 2022
1976ad0
Syntax
ABrain7710 Aug 31, 2022
96de816
Convert setup tasks to the way it was before
ABrain7710 Sep 1, 2022
839de9d
Add multiple workers with lower concurrency
ABrain7710 Sep 1, 2022
ea71a5e
define default collection. Incomplete
IsaacMilarky Sep 1, 2022
c5189a8
more progress
IsaacMilarky Sep 1, 2022
1f302b8
New routine implemented. Just need config integration now
IsaacMilarky Sep 2, 2022
24f3770
Add function that raises the open file limit and go back to running o…
ABrain7710 Sep 2, 2022
2092ac5
Add follow redirects
ABrain7710 Sep 2, 2022
5253a19
Merge branch 'augur-new-test' into augur-new-too-many-files
sgoggins Sep 2, 2022
01cf5d0
Merge pull request #1966 from chaoss/augur-new-too-many-files
sgoggins Sep 2, 2022
b98ca60
implement requested changes
IsaacMilarky Sep 2, 2022
326312c
merge changes with andrew's
IsaacMilarky Sep 2, 2022
2552fb8
Merge branch 'augur-new' into cli-subcomm
Priya730 Sep 4, 2022
45f99a1
1. changes made to match the schema
Priya730 Sep 4, 2022
1b568cc
added tool and data source
Priya730 Sep 4, 2022
73d5863
Fix merge conflicts
ABrain7710 Sep 4, 2022
3e4ecbe
Fix syntax errors
ABrain7710 Sep 4, 2022
065fe64
Fix syntax error
ABrain7710 Sep 4, 2022
b8b2eb0
Fix another small syntax error
ABrain7710 Sep 5, 2022
8a0bb4c
Make branch ready to merge into augur-new
ABrain7710 Sep 5, 2022
3928a3e
Merge branch 'new-routine' into merge-isaac-changes-with-andrew
ABrain7710 Sep 5, 2022
0e76235
Fix syntax error
ABrain7710 Sep 5, 2022
e160e77
Fix database engine closing error
ABrain7710 Sep 5, 2022
1c1d893
Fixing messages error possibly.
sgoggins Sep 5, 2022
466c3c2
put Andrew's git_url / url code back in augur/tasks/messages/tasks.py
sgoggins Sep 5, 2022
b924ef4
Add missing url paramater
ABrain7710 Sep 5, 2022
6d7c2ae
Fix iter_pages yield
ABrain7710 Sep 5, 2022
140ffd6
Merge pull request #1969 from chaoss/augur-new-test-micwa-spg
sgoggins Sep 5, 2022
4cc8672
Make session remove null data from strings before inserting
ABrain7710 Sep 5, 2022
c045ed1
Add logic to skip events that return insufficient data to relate to p…
ABrain7710 Sep 5, 2022
a6325d6
Fix syntax error
ABrain7710 Sep 6, 2022
5b3d5c0
Merge branch 'augur-new' into user-endpoints
Ulincsys Sep 6, 2022
416f228
Merge pull request #1953 from Priya730/user-endpoints
Ulincsys Sep 6, 2022
10e9d6b
Fix logging so it shows the owner and repo when collecting github data
ABrain7710 Sep 6, 2022
b2314ee
fix bad err handling
IsaacMilarky Sep 7, 2022
b7734d6
unnecessary logging
IsaacMilarky Sep 7, 2022
50efe12
Merge branch 'augur-new' into merge-isaac-changes-with-andrew
ABrain7710 Sep 7, 2022
3291a95
Remove commented out code
ABrain7710 Sep 7, 2022
843c69e
Merge branch 'merge-isaac-changes-with-andrew' of https://github.com/…
ABrain7710 Sep 7, 2022
26937ef
Remove duplicate import
ABrain7710 Sep 7, 2022
ade05e2
Add exception to catch NetworkErrors
ABrain7710 Sep 7, 2022
c8082b9
Sleep for the time github sends us when we get abuse mechanism detected
ABrain7710 Sep 7, 2022
5b94355
Respond with success if dict response doesn't contain the key 'message'
ABrain7710 Sep 7, 2022
07f2ff9
Migrate changes after git disaster
IsaacMilarky Sep 7, 2022
08d08db
Merge pull request #1975 from chaoss/augur-new-dev
ABrain7710 Sep 8, 2022
3fa914c
Add logic to remove duplicates from list of data before insertion
ABrain7710 Sep 8, 2022
6abb6ce
Fix circular import and remove wait on child tasks
ABrain7710 Sep 8, 2022
f380c68
Fix import errors
ABrain7710 Sep 8, 2022
96ff8d7
Merge branch 'augur-new-remove-dup-dicts' into augur-new-dev
ABrain7710 Sep 8, 2022
765a69e
Catch unique key violation in facade
ABrain7710 Sep 8, 2022
b372e9d
Merge pull request #1976 from chaoss/augur-new-dev
ABrain7710 Sep 8, 2022
6e41f2b
admin commands
Priya730 Sep 8, 2022
d0f3afe
Merge branch 'cli-subcomm' of https://github.com/Priya730/augur into …
Priya730 Sep 8, 2022
01719b9
Merge pull request #1977 from chaoss/augur-new-cntrb-insert-fix
ABrain7710 Sep 8, 2022
0a1a990
Merge branch 'augur-new' into process-dict-response-changes
ABrain7710 Sep 8, 2022
be4d692
Fix small error
ABrain7710 Sep 8, 2022
868e0b2
Merge pull request #1979 from chaoss/process-dict-response-changes
ABrain7710 Sep 8, 2022
860ef22
make detect_repo_move not take years by putting it in a celery group
IsaacMilarky Sep 9, 2022
7b98374
Try to run repo_info in group
IsaacMilarky Sep 9, 2022
87d45a6
Merge pull request #1981 from chaoss/augur-new-dev
IsaacMilarky Sep 9, 2022
49fca33
Hotfix for facade-breaking bug
IsaacMilarky Sep 9, 2022
254fe5c
Fix for null data errors
ABrain7710 Sep 9, 2022
34cc1c3
Merge branch 'augur-new-null-string-data' into augur-new-dev
ABrain7710 Sep 9, 2022
c77fa8e
Merge pull request #1968 from Priya730/cli-subcomm
Ulincsys Sep 11, 2022
807ad21
Merge pull request #1982 from chaoss/augur-new-null-string-data
sgoggins Sep 11, 2022
1576185
Merge pull request #1985 from chaoss/augur-new
sgoggins Sep 12, 2022
25e3040
Log full traceback of phase failure
IsaacMilarky Sep 12, 2022
a76f31b
upsert contributors based on uuid
IsaacMilarky Sep 12, 2022
0ca6a3f
Add exception to catch protocol error
ABrain7710 Sep 13, 2022
2465b33
Merge pull request #1987 from chaoss/catch-protocol-error
sgoggins Sep 13, 2022
2c6f5aa
Merge pull request #1988 from chaoss/augur-new
sgoggins Sep 13, 2022
8ceffb1
Remove null data from messages
ABrain7710 Sep 13, 2022
3bf1e5c
Add the rest of the fields to remove null string data
ABrain7710 Sep 13, 2022
50b3817
Merge pull request #1989 from chaoss/remove-null-string-values-github
sgoggins Sep 13, 2022
7e7afa9
Merge pull request #1990 from chaoss/augur-new
sgoggins Sep 13, 2022
c5fe0a0
Change uniques for prs and issues
ABrain7710 Sep 13, 2022
38c2c29
Merge pull request #1991 from chaoss/change-issue-pr-uniques
sgoggins Sep 13, 2022
5fa5618
Merge pull request #1992 from chaoss/augur-new
sgoggins Sep 13, 2022
f130246
Add phase switches in the config
IsaacMilarky Sep 14, 2022
a419a65
Add phase switches
IsaacMilarky Sep 14, 2022
6047593
Toggle switches work
IsaacMilarky Sep 14, 2022
fa83922
Make all phase stuff defined in one file now
IsaacMilarky Sep 14, 2022
8f72182
Make phase definition make sense
IsaacMilarky Sep 14, 2022
a24541e
apply first commit
Ulincsys Sep 6, 2022
4523234
merge
Ulincsys Sep 6, 2022
c58b661
fixed methods
Ulincsys Sep 13, 2022
09902a9
Merge pull request #1993 from chaoss/cherrypick-login-dev
sgoggins Sep 15, 2022
fbc1e56
compose fix
IsaacMilarky Sep 15, 2022
e7437b3
hotfix for config gen
IsaacMilarky Sep 16, 2022
29339b4
Merge branch 'augur-new-dev' into docker-compose-fix
IsaacMilarky Sep 16, 2022
8cc36ab
troubleshoot
IsaacMilarky Sep 19, 2022
d10fa9a
add docker compose for docker postgres db and external postgres db
IsaacMilarky Sep 21, 2022
c3b5789
try to squash bug from sean
IsaacMilarky Sep 23, 2022
2f9ddd8
Fixing for error:
sgoggins Sep 24, 2022
58c8cf5
respect unique constraint on issue_url
IsaacMilarky Sep 26, 2022
89b376e
revert
IsaacMilarky Sep 26, 2022
720e838
handle integrity error in issues
IsaacMilarky Sep 26, 2022
2c5bfb1
fix unique violations
IsaacMilarky Sep 26, 2022
12d0e13
Merge branch 'api-debug' into augur-new-dev
IsaacMilarky Sep 26, 2022
9526a6c
licensing api update.
sgoggins Sep 26, 2022
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
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@

[![Build Docker images](https://github.com/chaoss/augur/actions/workflows/build_docker.yml/badge.svg)](https://github.com/chaoss/augur/actions/workflows/build_docker.yml)

branch | status
--- | ---
main | [![Build Status](https://travis-ci.com/chaoss/augur.svg?branch=main)](https://travis-ci.com/chaoss/augur)
dev | [![Build Status](https://travis-ci.com/chaoss/augur.svg?branch=dev)](https://travis-ci.com/chaoss/augur)

[![Hits-of-Code](https://hitsofcode.com/github/chaoss/augur?branch=augur-new)](https://hitsofcode.com/github/chaoss/augur/view?branch=augur-new)

[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/2788/badge)](https://bestpractices.coreinfrastructure.org/projects/2788)

Expand Down
64 changes: 44 additions & 20 deletions augur/api/metrics/repo_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,26 +457,50 @@ def license_coverage(repo_group_id, repo_id=None):

if repo_id:
license_declared_SQL = s.sql.text("""
SELECT a.name, b.total as total_files, a.licensed as license_declared_files, round(a.licensed/b.total::numeric, 3) as coverage
FROM (
SELECT packages.name as name, count(file_license_id) as licensed
FROM packages,
files_licenses,
packages_files,
repo
WHERE packages.name = repo.repo_name
and repo.repo_id = :repo_id
and packages.package_id = packages_files.package_id
and packages_files.file_id = files_licenses.file_id
GROUP BY packages.name) a, (SELECT packages.name as name, count(packages_files.file_id) as total
FROm packages, repo, packages_files
WHERE packages.name = repo.repo_name
and repo.repo_id = :repo_id
AND packages.package_id = packages_files.package_id
GROUP BY packages.name
)b
WHERE a.name = b.name
GROUP BY a.name, a.licensed, a.licensed, b.total
SELECT B.NAME,
b.total AS total_files,
COALESCE(A.licensed,0) AS license_declared_files,
round( COALESCE(A.licensed :: NUMERIC, 0) / b.total :: NUMERIC, 3 ) AS coverage
FROM
(
SELECT
packages.NAME AS NAME,
COUNT ( packages_files.file_id ) AS total
FROM
spdx.packages,
repo,
spdx.packages_files
WHERE
packages.NAME = repo.repo_name
AND repo.repo_id = :repo_id
AND packages.package_id = packages_files.package_id
GROUP BY
packages.NAME
) b
left outer join
(
SELECT
packages.NAME AS NAME,
COUNT ( * ) AS licensed
FROM
spdx.packages,
spdx.files_licenses,
spdx.packages_files,
repo
WHERE
packages.NAME = repo.repo_name
AND repo.repo_id = :repo_id
AND packages.package_id = packages_files.package_id
AND packages_files.file_id = files_licenses.file_id
GROUP BY
packages.NAME
) A
on
A.NAME = b.NAME
GROUP BY
B.NAME,
A.licensed,
b.total
""")
else:
license_declared_SQL = s.sql.text("""
Expand Down
6 changes: 3 additions & 3 deletions augur/api/routes/auggie.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
def create_routes(server):


server.app.route('/auggie/get_user', methods=['POST'])
@server.app.route('/auggie/get_user', methods=['POST'])
def get_auggie_user():
# arg = [request.json]
# response = server.transform(metrics.get_auggie_user, args=arg)
Expand All @@ -271,7 +271,7 @@ def get_auggie_user():

return filteredUser

server.app.route('/auggie/update_tracking', methods=['POST'])
@server.app.route('/auggie/update_tracking', methods=['POST'])
def update_auggie_user_tracking():
# arg = [request.json]
# response = server.transform(metrics.update_tracking, args=arg)
Expand Down Expand Up @@ -317,7 +317,7 @@ def update_auggie_user_tracking():

return filtered_values

server.app.route('/auggie/slack_login', methods=['POST'])
@server.app.route('/auggie/slack_login', methods=['POST'])
def slack_login():
# arg = [request.json]
# response = server.transform(metrics.slack_login, args=arg)
Expand Down
4 changes: 2 additions & 2 deletions augur/api/routes/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

def create_routes(server):

server.app.route('/{}/batch'.format(AUGUR_API_VERSION), methods=['GET', 'POST'])
@server.app.route('/{}/batch'.format(AUGUR_API_VERSION), methods=['GET', 'POST'])
def batch():
"""
Execute multiple requests, submitted as a batch.
Expand Down Expand Up @@ -101,7 +101,7 @@ def batch():
@apiDescription Returns metadata of batch requests
POST JSON of API requests metadata
"""
server.app.route('/{}/batch/metadata'.format(AUGUR_API_VERSION), methods=['GET', 'POST'])
@server.app.route('/{}/batch/metadata'.format(AUGUR_API_VERSION), methods=['GET', 'POST'])
def batch_metadata():
"""
Returns endpoint metadata in batch format
Expand Down
22 changes: 13 additions & 9 deletions augur/api/routes/collection_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@

AUGUR_API_VERSION = 'api/unstable'


def create_routes(server):

server.app.route('/{}/collection_status/commits'.format(AUGUR_API_VERSION))
def commit_collection_status(): #TODO: make this name automatic - wrapper?
@server.app.route('/{}/collection_status/commits'.format(AUGUR_API_VERSION))
def commit_collection_status(): # TODO: make this name automatic - wrapper?
commit_collection_sql = s.sql.text("""
SELECT
repo_id,
Expand All @@ -34,13 +35,14 @@ def commit_collection_status(): #TODO: make this name automatic - wrapper?
repo_status = 'Complete'
""")
results = pd.read_sql(commit_collection_sql, server.engine)
data = results.to_json(orient="records", date_format='iso', date_unit='ms')
data = results.to_json(
orient="records", date_format='iso', date_unit='ms')
return Response(response=data,
status=200,
mimetype="application/json")

server.app.route('/{}/collection_status/issues'.format(AUGUR_API_VERSION))
def issue_collection_status(): #TODO: make this name automatic - wrapper?
@server.app.route('/{}/collection_status/issues'.format(AUGUR_API_VERSION))
def issue_collection_status(): # TODO: make this name automatic - wrapper?
issue_collection_sql = s.sql.text("""
SELECT
*
Expand Down Expand Up @@ -94,14 +96,15 @@ def issue_collection_status(): #TODO: make this name automatic - wrapper?
WHERE d.issues_enabled = 'true';
""")
results = pd.read_sql(issue_collection_sql, server.engine)
data = results.to_json(orient="records", date_format='iso', date_unit='ms')
data = results.to_json(
orient="records", date_format='iso', date_unit='ms')
parsed_data = json.loads(data)
return Response(response=data,
status=200,
mimetype="application/json")

server.app.route('/{}/collection_status/pull_requests'.format(AUGUR_API_VERSION))
def pull_request_collection_status(): #TODO: make this name automatic - wrapper?
@server.app.route('/{}/collection_status/pull_requests'.format(AUGUR_API_VERSION))
def pull_request_collection_status(): # TODO: make this name automatic - wrapper?
pull_request_collection_sql = s.sql.text("""
SELECT
*
Expand Down Expand Up @@ -163,7 +166,8 @@ def pull_request_collection_status(): #TODO: make this name automatic - wrapper?
ratio_abs;
""")
results = pd.read_sql(pull_request_collection_sql, server.engine)
data = results.to_json(orient="records", date_format='iso', date_unit='ms')
data = results.to_json(
orient="records", date_format='iso', date_unit='ms')
parsed_data = json.loads(data)
return Response(response=data,
status=200,
Expand Down
11 changes: 7 additions & 4 deletions augur/api/routes/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
import logging
import requests
import json
import os
from flask import request, jsonify, Response
import sqlalchemy as s

# Disable the requirement for SSL by setting env["AUGUR_DEV"] = True
development = os.getenv("AUGUR_DEV") or False

from augur.application.db.models import Config
from augur.application.db.session import DatabaseSession
Expand All @@ -31,9 +34,9 @@ def unsupported_method(error):
return jsonify({"status": "Unsupported method"}), 405


@server.app.route(f"/{AUGUR_API_VERSION}/config/get", methods=['POST'])
@server.app.route(f"/{AUGUR_API_VERSION}/config/get", methods=['GET', 'POST'])
def get_config():
if not request.is_secure:
if not development and not request.is_secure:
return generate_upgrade_request()

with DatabaseSession(logger) as session:
Expand All @@ -45,10 +48,10 @@ def get_config():

@server.app.route(f"/{AUGUR_API_VERSION}/config/update", methods=['POST'])
def update_config():
if not request.is_secure:
if not development and not request.is_secure:
return generate_upgrade_request()

update_dict= request.get_json()
update_dict = request.get_json()

with DatabaseSession(logger) as session:

Expand Down
16 changes: 10 additions & 6 deletions augur/api/routes/contributor_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -579,14 +579,16 @@ def filter_data(df, needed_columns, not_null_columns=[]):
if all(x in needed_columns for x in not_null_columns):

df = get_needed_columns(df, needed_columns)
df = remove_rows_with_null_values(df, not_null_columns)
#Use the pandas method bc the other method was erroring on boolean index.
#IM - 9/23/22
df = df.dropna(subset=not_null_columns)#remove_rows_with_null_values(df, not_null_columns)

return df
else:
print("Developer error, not null columns should be a subset of needed columns")
return df

server.app.route('/{}/contributor_reports/new_contributors_bar/'.format(AUGUR_API_VERSION), methods=["GET"])
@server.app.route('/{}/contributor_reports/new_contributors_bar/'.format(AUGUR_API_VERSION), methods=["GET"])
def new_contributors_bar():

repo_id, start_date, end_date, error = get_repo_id_start_date_and_end_date()
Expand All @@ -605,7 +607,9 @@ def new_contributors_bar():
not_null_columns = ['cntrb_id', 'created_at', 'month', 'year', 'repo_id', 'repo_name', 'login', 'action',
'rank', 'yearmonth', 'new_contributors', 'quarter']

input_df = remove_rows_with_null_values(input_df, not_null_columns)
#Use the pandas method bc the other method was erroring on boolean index.
#IM - 9/23/22
input_df = input_df.dropna(subset=not_null_columns)#remove_rows_with_null_values(input_df, not_null_columns)

if len(input_df) == 0:
return Response(response="There is no data for this repo, in the database you are accessing",
Expand Down Expand Up @@ -755,7 +759,7 @@ def new_contributors_bar():

return send_file(filename)

server.app.route('/{}/contributor_reports/new_contributors_stacked_bar/'.format(AUGUR_API_VERSION),
@server.app.route('/{}/contributor_reports/new_contributors_stacked_bar/'.format(AUGUR_API_VERSION),
methods=["GET"])
def new_contributors_stacked_bar():

Expand Down Expand Up @@ -958,7 +962,7 @@ def new_contributors_stacked_bar():

return send_file(filename)

server.app.route('/{}/contributor_reports/returning_contributors_pie_chart/'.format(AUGUR_API_VERSION),
@server.app.route('/{}/contributor_reports/returning_contributors_pie_chart/'.format(AUGUR_API_VERSION),
methods=["GET"])
def returning_contributors_pie_chart():

Expand Down Expand Up @@ -1090,7 +1094,7 @@ def returning_contributors_pie_chart():

return send_file(filename)

server.app.route('/{}/contributor_reports/returning_contributors_stacked_bar/'.format(AUGUR_API_VERSION),
@server.app.route('/{}/contributor_reports/returning_contributors_stacked_bar/'.format(AUGUR_API_VERSION),
methods=["GET"])
def returning_contributors_stacked_bar():

Expand Down
6 changes: 3 additions & 3 deletions augur/api/routes/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def create_routes(server):

pass

# server.app.route('/{}/add-repos'.format(AUGUR_API_VERSION), methods=['POST'])
# @server.app.route('/{}/add-repos'.format(AUGUR_API_VERSION), methods=['POST'])
# def add_repos():
# """ returns list of successfully inserted repos and repos that caused an error
# adds repos belonging to any user or group to an existing augur repo group
Expand Down Expand Up @@ -68,7 +68,7 @@ def create_routes(server):
# status=status_code,
# mimetype="application/json")

# server.app.route('/{}/create-repo-group'.format(AUGUR_API_VERSION), methods=['POST'])
# @server.app.route('/{}/create-repo-group'.format(AUGUR_API_VERSION), methods=['POST'])
# def create_repo_group():
# if authenticate_request(server.augur_app, request):
# group = request.json['group']
Expand Down Expand Up @@ -103,7 +103,7 @@ def create_routes(server):
# status=status_code,
# mimetype="application/json")

# server.app.route('/{}/import-org'.format(AUGUR_API_VERSION), methods=['POST'])
# @server.app.route('/{}/import-org'.format(AUGUR_API_VERSION), methods=['POST'])
# def add_repo_group():
# """ creates a new augur repo group and adds to it the given organization or user's repos
# takes an organization or user name
Expand Down
6 changes: 3 additions & 3 deletions augur/api/routes/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

def create_routes(server):

server.app.route('/{}/metadata/repo_info'.format(AUGUR_API_VERSION), methods=["GET"])
@server.app.route('/{}/metadata/repo_info'.format(AUGUR_API_VERSION), methods=["GET"])
def get_repo_info():
repo_info_sql = s.sql.text("""
SELECT
Expand Down Expand Up @@ -55,7 +55,7 @@ def get_repo_info():
status=200,
mimetype="application/json")

server.app.route('/{}/metadata/contributions_count'.format(AUGUR_API_VERSION), methods=["GET"])
@server.app.route('/{}/metadata/contributions_count'.format(AUGUR_API_VERSION), methods=["GET"])
def contributions_count():
repo_info_sql = s.sql.text("""
select repo_git, count(*) as contributions from contributor_repo
Expand All @@ -69,7 +69,7 @@ def contributions_count():
status=200,
mimetype="application/json")

server.app.route('/{}/metadata/contributors_count'.format(AUGUR_API_VERSION), methods=["GET"])
@server.app.route('/{}/metadata/contributors_count'.format(AUGUR_API_VERSION), methods=["GET"])
def contributors_count():
repo_info_sql = s.sql.text("""
select repo_git, count(distinct(cntrb_id)) as contributors from contributor_repo
Expand Down
4 changes: 2 additions & 2 deletions augur/api/routes/nonstandard_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@

def create_routes(server):

server.app.route(f"/{AUGUR_API_VERSION}/<license_id>/<spdx_binary>/<repo_group_id>/<repo_id>/license-files")
@server.app.route(f"/{AUGUR_API_VERSION}/<license_id>/<spdx_binary>/<repo_group_id>/<repo_id>/license-files")
def get_license_files(license_id, spdx_binary, repo_group_id, repo_id):
arguments = [license_id, spdx_binary, repo_group_id, repo_id]
license_files = server.transform(license_files, args=arguments)
return Response(response=license_files,
status=200,
mimetype="application/json")

server.app.route(f"/{AUGUR_API_VERSION}/repo-groups/<repo_group_id>/top-insights")
@server.app.route(f"/{AUGUR_API_VERSION}/repo-groups/<repo_group_id>/top-insights")
def top_insights(repo_group_id):
data = server.transform(top_insights, args=[repo_group_id])
return Response(response=data,
Expand Down
Loading