Skip to content

Commit 385afde

Browse files
authored
GOATS-1013 GOATS-1054 GOATS-1025 GOATS-1053 GOATS-1056: GOA fixes and logging. (#486)
- GOA bug fix for relative path issues when downloading files. - Add canonical to URL when querying GOA to appropriate URLs. - Add logging to track download progress and issues. - Refactor download_goa_files task to use observation record primary key. - Improve error handling when observation record is not found. - Add specialized logging to GOATS settings.py template.
1 parent 4c24ad8 commit 385afde

8 files changed

Lines changed: 473 additions & 179 deletions

File tree

docs/changes/486.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fixed bug when downloaded folders of data from GOA. GOA now organizes data into structured folders, and the code now correctly handles this structure when downloading and processing the data.

docs/changes/486.change.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added ``/canonical/`` to GOA URL paths as specified in GOA API documentation.

docs/changes/486.new.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added rotating log file to GOATS so users can keep track of operations over time and better report issues. Log files are stored in the main GOATS directory as "goats.log", with a maximum size of 50 MB and up to two backup files. The console logging remains for real-time feedback during execution.

src/goats_setup/templates/goats_setup/settings.tmpl

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,37 @@ MEDIA_URL = "/data/"
208208
LOGGING = {
209209
"version": 1,
210210
"disable_existing_loggers": False,
211+
"formatters": {
212+
"verbose": {
213+
"format": "{levelname} {asctime} {name} {filename}:{lineno} - {message}",
214+
"style": "{",
215+
},
216+
"simple": {
217+
"format": "{levelname} {message}",
218+
"style": "{",
219+
},
220+
},
211221
"handlers": {
212222
"console": {
213223
"class": "logging.StreamHandler",
214-
}
224+
"formatter": "simple",
225+
},
226+
"file": {
227+
"class": "logging.handlers.RotatingFileHandler",
228+
"filename": BASE_DIR / "goats.log",
229+
"formatter": "verbose",
230+
"maxBytes": 1024 * 1024 * 50, # 50 MB.
231+
"backupCount": 2, # Keep two backup log files.
232+
},
233+
},
234+
"loggers": {
235+
"": {"handlers": ["console", "file"], "level": "INFO"},
236+
"goats_tom": {
237+
"handlers": ["console", "file"],
238+
"level": "DEBUG",
239+
"propagate": False,
240+
},
215241
},
216-
"loggers": {"": {"handlers": ["console"], "level": "INFO"}},
217242
}
218243

219244
# Caching

0 commit comments

Comments
 (0)