Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ worker-tests:
importer-tests:
cd gcp/workers/importer && ./run_tests.sh

alias-tests:
cd gcp/workers/alias && ./run_tests.sh

recoverer-tests:
cd gcp/workers/recoverer && ./run_tests.sh

Expand Down
11 changes: 1 addition & 10 deletions gcp/workers/alias/alias_computation.py → gcp/website/emulator_aliases.py
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#!/usr/bin/env python3
# Copyright 2023 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -21,7 +20,6 @@

import osv
from osv import gcs, pubsub
import osv.logs

ALIAS_GROUP_VULN_LIMIT = 32
VULN_ALIASES_LIMIT = 5
Expand Down Expand Up @@ -139,7 +137,7 @@ def transaction():
vuln_proto.SerializeToString(deterministic=True), type='gcs_retry')


def main():
def run():
"""Updates all alias groups in the datastore by re-computing existing
AliasGroups and creating new AliasGroups for un-computed bugs."""

Expand Down Expand Up @@ -203,10 +201,3 @@ def main():
# For each updated vulnerability, update them in Datastore & GCS
for vuln_id, alias_group in changed_vulns.items():
_update_vuln_with_group(vuln_id, alias_group)


if __name__ == '__main__':
_ndb_client = ndb.Client()
osv.logs.setup_gcp_logging('alias')
with _ndb_client.context():
main()
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
from google.cloud import ndb

import osv
import osv.logs
from osv import gcs, pubsub


Expand Down Expand Up @@ -196,7 +195,7 @@ def set_default(obj):
target_upstream_group.put()


def main():
def run():
"""Updates all upstream groups in the datastore by re-computing existing
UpstreamGroups and creating new UpstreamGroups for un-computed bugs."""

Expand Down Expand Up @@ -242,10 +241,3 @@ def main():
# Recompute the upstream hierarchies
compute_upstream_hierarchy(group, upstream_groups)
logging.info('Upstream hierarchy updated for bug: %s', group.db_id)


if __name__ == '__main__':
_ndb_client = ndb.Client()
osv.logs.setup_gcp_logging('upstream')
with _ndb_client.context():
main()
8 changes: 5 additions & 3 deletions gcp/website/frontend_emulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
from google.cloud import ndb
import osv
import datetime
from gcp.workers.alias import upstream_computation, alias_computation

import emulator_aliases
import emulator_upstream

if __name__ == '__main__':
# The datastore emulator needs to be started before main is imported
Expand Down Expand Up @@ -115,8 +117,8 @@ def _load_dir(emulator, dir_path: str):
bug.put()

# Compute upstream/alias groups based on loaded bugs.
upstream_computation.main()
alias_computation.main()
emulator_aliases.run()
emulator_upstream.run()

for b in osv.Bug.query():
b.put()
Expand Down
20 changes: 0 additions & 20 deletions gcp/workers/alias/Dockerfile

This file was deleted.

Loading
Loading