Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
93c6bfa
Merge branch 'qat' of https://github.com/fedspendingtransparency/usas…
boozallendanny Mar 30, 2026
772dc8a
Merge branch 'qat' of https://github.com/fedspendingtransparency/usas…
boozallendanny Apr 1, 2026
6b4bea3
Merge branch 'qat' of https://github.com/fedspendingtransparency/usas…
boozallendanny Apr 8, 2026
07986b0
update data dictionary s3 bucket path
boozallendanny Apr 8, 2026
0387115
add logging settings
boozallendanny Apr 8, 2026
59c4743
Ruff formatter fixes
aguest-kc Apr 14, 2026
5d66e07
Merge branch 'qat' into mod/settings-update-fapc
aguest-kc Apr 14, 2026
91d8267
update s3 get_simple_url
boozallendanny Apr 20, 2026
f780cd2
remove mid slash
boozallendanny Apr 20, 2026
76515e7
Merge branch 'qat' of https://github.com/fedspendingtransparency/usas…
boozallendanny Apr 20, 2026
8049160
Merge branch 'qat' into mod/settings-update-fapc
boozallendanny Apr 20, 2026
017a2ff
Merge branch 'qat' of https://github.com/fedspendingtransparency/usas…
boozallendanny Apr 23, 2026
f745c26
Merge branch 'qat' of https://github.com/fedspendingtransparency/usas…
boozallendanny Apr 28, 2026
33ae7e2
Merge branch 'qat' into mod/settings-update-fapc
boozallendanny Apr 28, 2026
f1b2040
Merge branch 'qat' of https://github.com/fedspendingtransparency/usas…
boozallendanny May 6, 2026
1984f73
update data dictionary s3 key
boozallendanny May 15, 2026
ef12dd9
Merge branch 'qat' of https://github.com/fedspendingtransparency/usas…
boozallendanny Jun 29, 2026
e78a1cd
Merge branch 'qat' into mod/settings-update-fapc
boozallendanny Jun 29, 2026
59a286c
Adds logging for gtas_command
collinwr Jun 30, 2026
992edcd
remove master branch
boozallendanny Jul 16, 2026
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
2 changes: 1 addition & 1 deletion usaspending_api/common/spark/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def handle_start(self, job_name: str, command_name: str, command_options: list[s
mode="BATCH",
jobDriver={
"sparkSubmit": {
"entryPoint": f"s3://{CONFIG.SPARK_S3_BUCKET}/master/manage.py",
"entryPoint": f"s3://{CONFIG.SPARK_S3_BUCKET}/manage.py",
"entryPointArguments": [command_name, *command_options],
}
},
Expand Down
6 changes: 1 addition & 5 deletions usaspending_api/download/filestreaming/s3_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,5 @@ def get_simple_url(self, file_name):
Gets URL for read
"""
bucket_url = f"{settings.FILES_SERVER_BASE_URL}/{self.redirect_dir}/"
env_dir = ""
if self.redirect_dir == settings.BULK_DOWNLOAD_S3_REDIRECT_DIR and self.environment != "production":
# currently only downloads have a bucket per environment
env_dir = f"{self.environment}/"
generated = f"{bucket_url}{env_dir}{file_name}"
generated = f"{bucket_url}{file_name}"
return generated
8 changes: 6 additions & 2 deletions usaspending_api/references/management/commands/load_gtas.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,12 @@ def process_data(self) -> None:
total_obligation_objs = [GTASSF133Balances(**values) for values in total_obligation_values]

logger.info("Loading new GTAS records into database")
new_rec_count = len(GTASSF133Balances.objects.bulk_create(total_obligation_objs))
logger.info(f"Loaded: {new_rec_count:,} records")
try:
new_rec_count = len(GTASSF133Balances.objects.bulk_create(total_obligation_objs))
logger.info(f"Loaded: {new_rec_count:,} records")
except Exception as e:
logger.error(f"Error during bulk_create: {type(e).__name__}: {str(e)}")
raise

load_rec = self._execute_dml_sql(self.tas_fk_sql, "Populating TAS foreign keys")
logger.info(f"Set {load_rec:,} TAS FKs in GTAS table, {new_rec_count - load_rec:,} NULLs")
Expand Down
54 changes: 40 additions & 14 deletions usaspending_api/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,14 @@
)

# S3 Bucket and Key to retrieve the Data Dictionary
DATA_DICTIONARY_S3_BUCKET_NAME = f"dti-da-public-files-{'nonprod' if CONFIG.ENV_CODE not in ('prd', 'stg') else 'prod'}"
DATA_DICTIONARY_S3_KEY = f"user_reference_docs/{DATA_DICTIONARY_FILE_NAME}"
DATA_DICTIONARY_S3_BUCKET_NAME = os.environ.get(
"DATA_DICTIONARY_S3_BUCKET_NAME",
f"dti-da-public-files-{'nonprod' if CONFIG.ENV_CODE not in ('prd', 'stg') else 'prod'}"
)
DATA_DICTIONARY_S3_KEY = os.environ.get(
"DATA_DICTIONARY_S3_KEY",
f"user_reference_docs/{DATA_DICTIONARY_FILE_NAME}"
)

# Local download files
IDV_DOWNLOAD_README_FILE_PATH = str(APP_DIR / "data" / "idv_download_readme.txt")
Expand Down Expand Up @@ -434,6 +440,36 @@ def _configure_database_connection(
logs_dir.mkdir(parents=True, exist_ok=True)
console_log_file_path.touch(exist_ok=True)

# Logging settings adjusted based on env
fapc = os.environ.get("FAPC", "")

if fapc:
server_handler = {
"level": "DEBUG",
"class": "logging.StreamHandler",
"stream": "ext://sys.stdout",
"formatter": "user_readable"
}
console_file_handler = {
"level": "DEBUG",
"class": "logging.StreamHandler",
"stream": "ext://sys.stdout",
"formatter": "specifics"
}
else:
server_handler = {
"level": "DEBUG",
"class": "logging.handlers.WatchedFileHandler",
"filename": str(APP_DIR / "logs" / "server.log"),
"formatter": "user_readable",
}
console_file_handler = {
"level": "DEBUG",
"class": "logging.handlers.WatchedFileHandler",
"filename": str(APP_DIR / "logs" / "console.log"),
"formatter": "specifics",
}

LOGGING = {
"version": 1,
"disable_existing_loggers": False,
Expand All @@ -460,18 +496,8 @@ def _configure_database_connection(
},
},
"handlers": {
"server": {
"level": "DEBUG",
"class": "logging.handlers.WatchedFileHandler",
"filename": str(APP_DIR / "logs" / "server.log"),
"formatter": "user_readable",
},
"console_file": {
"level": "DEBUG",
"class": "logging.handlers.WatchedFileHandler",
"filename": str(APP_DIR / "logs" / "console.log"),
"formatter": "specifics",
},
"server": server_handler,
"console_file": console_file_handler,
"console": {
"level": "DEBUG",
"class": "logging.StreamHandler",
Expand Down
Loading