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

DRAFT Read replication and moving the API to a second database #4427

Draft
wants to merge 96 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
96 commits
Select commit Hold shift + click to select a range
f1e4a70
Updating with new layout
jadudm Sep 27, 2024
40158bb
Updating/cleaning up for testing
jadudm Sep 27, 2024
660b98e
Merge branch 'main' into jadudm/api-perf
jadudm Sep 27, 2024
b2263e7
In-progress.
jadudm Sep 29, 2024
d54e8fa
Updating ignores...
jadudm Sep 29, 2024
7e54577
Runs a ffull sequence
jadudm Sep 30, 2024
6e4470e
Cleaining up
jadudm Sep 30, 2024
70e2a13
Updating .profile to match run.sh
jadudm Sep 30, 2024
a31eea0
Bringup for the Admin API
jadudm Oct 2, 2024
b3e8523
Cleanup, missed files.
jadudm Oct 2, 2024
e4fa18f
These are important...
jadudm Oct 2, 2024
de6c7ea
Adding GH action, script
jadudm Oct 2, 2024
b30ba03
Expand the admin API to increase visibility
jadudm Oct 2, 2024
1337097
Full-up, with performance testing
jadudm Oct 3, 2024
65f7365
Updates for live test.
jadudm Oct 4, 2024
1be0b83
Improving/simplifying
jadudm Oct 5, 2024
a809bea
Ready for testing in preview
jadudm Oct 9, 2024
88bc8a5
Source the script...
jadudm Oct 9, 2024
0e4f240
Fix path to sling
jadudm Oct 9, 2024
a94598c
Making the checks noisy.
jadudm Oct 9, 2024
2006d8a
Noisyer.
jadudm Oct 9, 2024
b95cb61
Don't exit so quickly...
jadudm Oct 9, 2024
6f1d153
Try to catch the error and continue if found
asteel-gsa Oct 9, 2024
8c2a047
Before further renaming.
jadudm Oct 10, 2024
e3cc950
Simplified.
jadudm Oct 10, 2024
eb12bad
Forgot to delete a bunch of things...
jadudm Oct 10, 2024
d5d4915
Set +/-e around check...
jadudm Oct 10, 2024
6b45c49
Trying to get past error...
jadudm Oct 10, 2024
328e9b9
Fixing SQL checks
jadudm Oct 10, 2024
3539ffc
Still... fixing return values...
jadudm Oct 10, 2024
1093b0f
Make the sources the same
jadudm Oct 10, 2024
cd525cb
Fix echo statements
jadudm Oct 10, 2024
cbadf2c
Try set -e?
jadudm Oct 10, 2024
2b33286
What about set +e...
jadudm Oct 10, 2024
cf6b5c9
Working around bash...
jadudm Oct 10, 2024
a511d9c
Incremental on removal of Tribal/admin API.
jadudm Oct 22, 2024
a58ebb2
Big update...
jadudm Oct 24, 2024
d1238ec
Merge branch 'main' into jadudm/api-perf
jadudm Oct 24, 2024
2ea604a
Simulating pre-deploy backup
jadudm Oct 24, 2024
8b5d43a
Fixes Minio, copies data
jadudm Oct 25, 2024
1656bad
Using a VCAP_SERVICES locally
jadudm Oct 25, 2024
6f5b205
Minor change, move to /tmp
jadudm Oct 25, 2024
9ea4a29
Move curation tracking init
jadudm Oct 25, 2024
cb0fa77
Removing unnecessary CREATE SCHEMA
jadudm Oct 25, 2024
03a4e6d
Fixed my partial rename
jadudm Oct 25, 2024
1747897
This points advanced search at pd.combined
jadudm Oct 25, 2024
7315cf9
Admin Panel and touch-ups
rnovak338 Oct 25, 2024
0ff0629
Remove Sling README
rnovak338 Oct 25, 2024
551f85e
Moves general back into the public_100 tables.
jadudm Oct 25, 2024
5f300a2
Merge branch 'jadudm/api-perf' of github.com:GSA-TTS/FAC into jadudm/…
jadudm Oct 25, 2024
affe2b7
Simplified run.sh
jadudm Oct 25, 2024
3aa6266
Updated the sling script for bulk data
jadudm Oct 25, 2024
d329f27
Simplified local data load
jadudm Oct 25, 2024
c2149f1
Updating to reflect new startup sequence
jadudm Oct 28, 2024
e1a3bb8
And, forgot the sourcing...
jadudm Oct 28, 2024
edf2c1f
Fake audit, test if migrations will go through
asteel-gsa Oct 28, 2024
5dd7e92
Add replaces to Django
asteel-gsa Oct 28, 2024
db1927b
Undo
asteel-gsa Oct 28, 2024
3ec3e81
Should fix local standup/build
jadudm Oct 28, 2024
ffad20f
Removing orderby on combined
jadudm Oct 29, 2024
409792b
Splits things away from startup
jadudm Oct 29, 2024
7abe12a
Prep API Standup Test
asteel-gsa Oct 29, 2024
decc89a
Fixes run.sh
jadudm Oct 29, 2024
dcb3581
Merge branch 'jadudm/api-perf' of github.com:GSA-TTS/FAC into jadudm/…
jadudm Oct 29, 2024
337ea0d
Update Cypress E2E API checks
rnovak338 Oct 29, 2024
f2ae9de
Changing apparent error to warning
jadudm Oct 29, 2024
df8236d
Fixing email, whitespace
jadudm Oct 29, 2024
f2055c5
Test api refresh
asteel-gsa Oct 29, 2024
825a3e0
Api chmod +x
asteel-gsa Oct 29, 2024
814a5a7
Remove historical data load
asteel-gsa Oct 29, 2024
72a86a0
Push to run api_refresh
asteel-gsa Oct 29, 2024
04970aa
Use pushd & popd to put us where we need to be for source & other utils
asteel-gsa Oct 29, 2024
d2d910d
API Refresh test
asteel-gsa Oct 29, 2024
53ede5a
Overthinking bash pathing
asteel-gsa Oct 29, 2024
5f8a7ec
Debugging typo removal
asteel-gsa Oct 29, 2024
9b361e9
Version bump backup-util to v0.1.9
asteel-gsa Oct 29, 2024
bdbbe31
TF, sequencing
jadudm Oct 29, 2024
cf769b9
API Refresh Test - Final?
asteel-gsa Oct 29, 2024
8977b6d
disable api refresh on push
asteel-gsa Oct 29, 2024
209c26a
Testing with data
jadudm Oct 30, 2024
38ac254
Allows for configuration of the DB
jadudm Oct 31, 2024
8033d3d
Merge branch 'main' into jadudm/api-perf
jadudm Oct 31, 2024
ec602d5
Adding documentation
jadudm Oct 31, 2024
2d009d6
Update api refresh workflow
asteel-gsa Nov 1, 2024
e569dc6
Fix workflows
asteel-gsa Nov 1, 2024
fc614dd
Fixing two missing tables...
jadudm Nov 1, 2024
ab68fa0
Updating tests.
jadudm Nov 1, 2024
24c2c5c
Linting
rnovak338 Nov 7, 2024
8815dd2
Document django admin access
rnovak338 Nov 7, 2024
04a85b8
Merge branch 'main' into jadudm/api-perf
rnovak338 Nov 7, 2024
f2084e9
Linting
rnovak338 Nov 7, 2024
b04e944
More linting - bandit
rnovak338 Nov 8, 2024
0256047
Reformat local python API tests to rest of the testing suite
rnovak338 Nov 8, 2024
015af34
FE Linting
rnovak338 Nov 8, 2024
d1a17ae
Merge branch 'main' into jadudm/api-perf
rnovak338 Nov 14, 2024
04e19e4
Linting
rnovak338 Nov 14, 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
Prev Previous commit
Linting
rnovak338 committed Nov 14, 2024
commit 04e19e4f6a92aeb33012d6ca0744972523514a69
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import argparse
import time

from util import (
from census_historical_migration.throwaway_scripts.util import (
trigger_migration_workflow,
)
import subprocess # nosec
Original file line number Diff line number Diff line change
@@ -2,7 +2,9 @@
import subprocess # nosec
import time

from util import trigger_migration_workflow
from census_historical_migration.throwaway_scripts.util import (
trigger_migration_workflow,
)

# This throwaway script spits out code that can be
# copy-pasted into a bash script, or directly into the command line.
Original file line number Diff line number Diff line change
@@ -7,21 +7,22 @@
import yaml
from datetime import datetime

obj = {"streams": dict()}

obj["source"] = "FAC_SNAPSHOT_URI"
obj["target"] = "BULK_DATA_EXPORT"
obj["defaults"] = {
"target_options": {
"format": "csv",
"compression": "gzip",
"file_max_rows": 0,
}
obj: dict = {
"streams": {},
"source": "FAC_SNAPSHOT_URI",
"target": "BULK_DATA_EXPORT",
"defaults": {
"target_options": {
"format": "csv",
"compression": "gzip",
"file_max_rows": 0,
}
},
}

schema = "public_data_v1_0_0"
SCHEMA = "public_data_v1_0_0"

tables = [
TABLES = [
"additional_eins",
"additional_ueis",
"combined",
@@ -39,15 +40,15 @@
# it will not generate anything where data does not exist.
# This future-proofs us for a year or two, so we don't have to worry
# about updating the `sling` script that is created.
years = range(2016, 2031)
YEARS = range(2016, 2031)


for t in tables:
for t in TABLES:
ndx = 0
for y in years:
obj["streams"][f"{schema}.{t}.{ndx}"] = {
for y in YEARS:
obj["streams"][f"{SCHEMA}.{t}.{ndx}"] = {
"object": f"bulk_export/{{MM}}/{y}_{t}.csv",
"sql": f"SELECT * FROM {schema}.{t} WHERE audit_year = '{y}'",
"sql": f"SELECT * FROM {SCHEMA}.{t} WHERE audit_year = '{y}'",
"mode": "full-refresh",
"target_options": {
"format": "csv",
4 changes: 2 additions & 2 deletions backend/dissemination/sql/test_api.py
Original file line number Diff line number Diff line change
@@ -95,7 +95,7 @@ def _helper(endpoint, keys):
| limit(0, EnvVars.RECORDS_REQUESTED - 1)
| api(api_version)
)
r = requests.get(base + f"/{endpoint}", headers=h)
r = requests.get(base + f"/{endpoint}", headers=h, timeout=60)
self.good_resp(r.json(), keys)

return _helper
@@ -117,7 +117,7 @@ def test_api_v1_0_3_not_exist(self):
print("This schema/API should not exist.")
self.assertTrue(False)
except Exception:
pass
self.assertTrue(True)

def test_api_v1_1_0(self):
f = self.cons(self.ENV, "api_v1_1_0")
3 changes: 3 additions & 0 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
@@ -35,11 +35,14 @@ disable = [

[tool.bandit]
# TDB 2022-12-07 - test_schemas and test_validators use random number generation, which bandit doesn't like
# 2024-11-14 - create_stream_yaml and create_partition_statements will never be touched by users, yet bandit doesn't like the SQL injection risk.
exclude_dirs = [
"audit/cross_validation/test_check_has_federal_awards.py",
"audit/test_schemas.py",
"audit/test_validators.py",
"node_modules",
"dissemination/sql/fac-snapshot-db/create_partition_statements.py",
"dissemination/sql/sling/bulk_data_export/create_stream_yaml.py",
"dissemination/test_search.py",
"dissemination/tests.py",
".venv"
8 changes: 4 additions & 4 deletions backend/util/api_perf_test/perf.py
Original file line number Diff line number Diff line change
@@ -138,10 +138,10 @@ def make_ratios(d1, d2):


if __name__ == "__main__":
results1 = {}
results2 = {}
results3 = {}
results4 = {}
results1: dict = {}
results2: dict = {}
results3: dict = {}
results4: dict = {}

results1["api110_by_year"] = fetch_fa_by_year_exp("api_v1_1_0")
results1["ap110"] = fetch_fa_exp("api_v1_1_0")