-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix anonymous reading in materialize and add rate limited logging. (#898
) * Fix anonymous reading in materialize and add rate limited logging. * In materialize, try reading using the credentials, but if it doesn't work, fall back to reading anonymously if that seems to be working. * Add rate limited logging to reading via materialize in local mode. * Check for no root before checking if a source since that makes more sense. * switch ntsb_loader_materialized.py over to read in local mode, it was working (with the anonymous fix), but was very slow hence the logging.
- Loading branch information
1 parent
1b102e3
commit 0e9fd44
Showing
4 changed files
with
102 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
lib/sycamore/sycamore/tests/unit/utils/test_sycamore_logger.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import logging | ||
import time | ||
|
||
from sycamore.utils.sycamore_logger import LoggerFilter | ||
|
||
|
||
def test_logger_ratelimit(caplog): | ||
logger = logging.getLogger("test_sycamore") | ||
|
||
with caplog.at_level(logging.INFO): | ||
for i in range(5): | ||
logger.info(f"Unbounded {i}") | ||
|
||
logger.addFilter(LoggerFilter()) | ||
for i in range(5): | ||
logger.info(f"Bounded {i}") | ||
|
||
time.sleep(1) | ||
logger.info("Bounded After") | ||
|
||
for i in range(5): | ||
assert f"Unbounded {i}\n" in caplog.text | ||
|
||
assert "Bounded 0" in caplog.text | ||
for i in range(1, 5): | ||
assert f"Bounded {i}\n" not in caplog.text | ||
|
||
assert "Bounded After\n" in caplog.text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters