Skip to content

Make sure old files are not picked up and add regex to search log output #1

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 4 commits into from
Aug 31, 2023

Conversation

mraspaud
Copy link
Member

@mraspaud mraspaud commented Aug 18, 2023

This PR saves the state of the directory to make sure only new files are picked.

Also adds the possibility to use a configured regex to parse new filenames from the script log.

@mraspaud mraspaud added the enhancement New feature or request label Aug 18, 2023
@mraspaud mraspaud requested a review from pnuu August 18, 2023 07:43
@mraspaud mraspaud self-assigned this Aug 18, 2023
@codecov
Copy link

codecov bot commented Aug 18, 2023

Codecov Report

❗ No coverage uploaded for pull request base (main@5b50920). Click here to learn what that means.
The diff coverage is n/a.

❗ Current head c046079 differs from pull request most recent head af59762. Consider uploading reports for the commit af59762 to get more accurate results

@@           Coverage Diff           @@
##             main       #1   +/-   ##
=======================================
  Coverage        ?   98.73%           
=======================================
  Files           ?        2           
  Lines           ?      316           
  Branches        ?        0           
=======================================
  Hits            ?      312           
  Misses          ?        4           
  Partials        ?        0           

Copy link
Member

@pnuu pnuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some (untested) changes suggested to remove the global variable.

@mraspaud
Copy link
Member Author

@pnuu I think I addressed your comments.

@mraspaud
Copy link
Member Author

mraspaud commented Aug 18, 2023

Ok, this supports now regexes also.

Copy link
Member

@pnuu pnuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just one suggested simplification.

pub.send(message)


def generate_message_from_log_output(publisher_config, mda, log_output):
"""Generate message for the filenames present in the log output."""
new_files = re.findall(publisher_config["output_files_log_regex"], str(log_output))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if there's a regex pattern in the config, the output from the called script is parsed to catch the filenames? Handy.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes exactly.

@mraspaud mraspaud merged commit d26b8d7 into main Aug 31, 2023
@mraspaud mraspaud deleted the feature-check-directory-before branch August 31, 2023 09:13
@mraspaud mraspaud changed the title Make sure old files are not picked up Make sure old files are not picked up and add regex to search log output Aug 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants