Adding preprocessing step to speedup the parsing.
Build succeeded.
Metadata Update from @nphilipp: - Request assigned
Some ideas/thoughts (here because it'd become too scattered inline, in no particular order):
stdout
subprocess.run()
pre_process()
ReadProgress
[1]: like this:
rawlog_path = "/mnt/fedora_stats/combined-http/latest/mirrors.fedoraproject.org-access.log" processedlog_path = "/tmp/countme.py.out" with open(rawlog_path, "rt") as rawlog, open(processedlog_path, "wt") as processedlog: for l in rawlog: if "countme" in l: print(l, end="", file=processedlog)
2 new commits added
Add pre-processing step that uses grep to speedup parsing
Added preprocessing step.
I did change it to local temporary file with a context-manager to clean-up after itself.
What you suggest with python being as fast as grep, I am not sure the problem is with bandwidth, as when I was testing it localy, there was no network access to slow things down.
It could be the case of the speedup I have observed was due to caching? I.e. I did re-run it several times, it was on my local disk, e.t.c.
rebased onto 86deda1cceea940eb335d1de007c38e64854d7c1
rebased onto 4bde590ea0ba3e97437ab6134e3cddffc2e57808
rebased onto 9cd422c43aaf0811292d4a1b8f78af16b838de57
rebased onto 07c43eb76b1a28b64399a85551aa47d6da9711b9
Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci
Hmm, TIL that type-annotating generators/iterables isn't that straight-forward:
mypy run-test: commands[0] | python -m mypy --config-file /workspace/src/pagure.io/mirrors-countme/mypy.cfg . countme/progress.py:91: error: The return type of a generator function should be "Generator" or one of its supertypes countme/progress.py:91: error: Argument 1 to "contextmanager" has incompatible type "Callable[[Union[str, Path]], str]"; expected "Callable[..., Iterator[<nothing>]]" countme/parse.py:9: error: The return type of a generator function should be "Generator" or one of its supertypes countme/parse.py:9: error: Argument 1 to "contextmanager" has incompatible type "Callable[[Union[str, Path]], str]"; expected "Callable[..., Iterator[<nothing>]]" Found 4 errors in 2 files (checked 12 source files) ERROR: InvocationError for command /workspace/src/pagure.io/mirrors-countme/.tox/mypy/bin/python -m mypy --config-file mypy.cfg . (exited with code 1)
rebased onto 58d56f1c476ea5d222af6b26ae663bed16f51433
Pull-Request has been merged by nphilipp
Adding preprocessing step to speedup the parsing.