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

Increase debug error logging and handle bytes type log output #24

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
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
Bugfix
Signed-off-by: Adam.Dybbroe <[email protected]>
Adam.Dybbroe committed Jan 5, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit c83ad841b1d0633cc1d1a7356927a7ebf1acc77d
12 changes: 6 additions & 6 deletions pytroll_runner/__init__.py
Original file line number Diff line number Diff line change
@@ -187,14 +187,14 @@ def run_on_files(command, files):

def generate_message_from_log_output(publisher_config, mda, log_output):
"""Generate message for the filenames present in the log output."""
logstring = str(log_output)
logger.debug(logstring)
if isinstance(logstring, bytes):
logstring = logstring.decode('utf-8')
logger.debug(f"type(log_output) = {type(log_output)}")
logger.debug(log_output)
if isinstance(log_output, bytes):
log_output = log_output.decode('utf-8')

logger.debug(str(publisher_config["output_files_log_regex"]))
new_files = re.findall(publisher_config["output_files_log_regex"], logstring)
logger.debug(f"Output files identified = str{new_files}")
new_files = re.findall(publisher_config["output_files_log_regex"], log_output)
logger.debug(f"Output files identified = {new_files}")
if len(new_files) == 0:
logger.warning("No output files to publish identified!")
message = generate_message_from_new_files(publisher_config, new_files, mda)