-
Notifications
You must be signed in to change notification settings - Fork 33
Improve ocrd_network logging #1111
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
c81d312
refactor logging constants
MehmedGIT dbf06b6
add log file to job models
MehmedGIT 3fa1370
fix bug: file mode a
MehmedGIT 8b07f07
improve: use tempdir
MehmedGIT a083808
use pathlib instead of os.path
MehmedGIT 6bfae6a
use ocrd_utils LOG_FORMAT
MehmedGIT 464f8ea
add logs and sockets env
MehmedGIT c81ffcc
add get log endpoint
MehmedGIT 76fe9ac
fix: use Path not str
MehmedGIT 32cddbe
Fix: use Path not str 2
joschrew 4a57777
ocrd --help: document new config options for ocrd_network
kba File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,47 @@ | ||
| from pathlib import Path | ||
| from ocrd_utils import safe_filename, config | ||
|
|
||
|
|
||
| OCRD_NETWORK_MODULES = [ | ||
| "mets_servers", | ||
| "processing_jobs", | ||
| "processing_servers", | ||
| "processing_workers", | ||
| "processor_servers" | ||
| ] | ||
|
|
||
|
|
||
| def get_root_logging_dir(module_name: str) -> Path: | ||
| if module_name not in OCRD_NETWORK_MODULES: | ||
| raise ValueError(f"Invalid module name: {module_name}, should be one of: {OCRD_NETWORK_MODULES}") | ||
| module_log_dir = Path(config.OCRD_NETWORK_LOGS_ROOT_DIR, module_name) | ||
| module_log_dir.mkdir(parents=True, exist_ok=True) | ||
| return module_log_dir | ||
|
|
||
|
|
||
| def get_cache_locked_pages_logging_file_path() -> Path: | ||
| return get_root_logging_dir("processing_servers") / "cache_locked_pages.log" | ||
joschrew marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
|
|
||
| def get_cache_processing_requests_logging_file_path() -> Path: | ||
| return get_root_logging_dir("processing_servers") / "cache_processing_requests.log" | ||
|
|
||
|
|
||
| def get_processing_job_logging_file_path(job_id: str) -> Path: | ||
| return get_root_logging_dir("processing_jobs") / f"{job_id}.log" | ||
|
|
||
|
|
||
| def get_processing_server_logging_file_path(pid: int) -> Path: | ||
| return get_root_logging_dir("processing_servers") / f"server.{pid}.log" | ||
|
|
||
|
|
||
| def get_processing_worker_logging_file_path(processor_name: str, pid: int) -> Path: | ||
| return get_root_logging_dir("processing_workers") / f"worker.{pid}.{processor_name}.log" | ||
|
|
||
|
|
||
| def get_processor_server_logging_file_path(processor_name: str, pid: int) -> Path: | ||
| return get_root_logging_dir("processor_servers") / f"server.{pid}.{processor_name}.log" | ||
|
|
||
|
|
||
| def get_mets_server_logging_file_path(mets_path: str) -> Path: | ||
| return get_root_logging_dir("mets_servers") / f"{safe_filename(mets_path)}.log" | ||
This file contains hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.