-
Notifications
You must be signed in to change notification settings - Fork 94
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
Fix scheduler#shutdown when reference-log option is used #3035
Fix scheduler#shutdown when reference-log option is used #3035
Conversation
Haha, I guess we have a gazillion tests that use "reference logs" (which contain what-triggered-off-what info) but never thought to make a test that generates one 😬 |
Adding @matthewrmshin as reviewer - he is the author of the relevant code block. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic in this block seems a bit odd to me:
- open the "reference log" for writing in binary mode
- open the main suite log file for reading in text mode
- read the main log line by line (as strings)
- filter for certain lines and write them to the reference log
Shouldn't we just open the reference log file in text mode??
An over-the-top 2to3 change? |
Yes, I expect so!
…On Sat, 23 Mar 2019, 11:30 Matt Shin, ***@***.***> wrote:
An over-the-top 2to3 change?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3035 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACQLGVpgESbz5p_nBWjjv1y3wNa1pH06ks5vZVltgaJpZM4cCzOa>
.
|
@kinow @matthewrmshin do you agree with my comment:
If so let's just do that, no? (The only reason I'm a bit hesitant is I'm not fully up to speed yet with Python 3 string encoding ... but I expect you guys are). |
Now that I am awake on Monday... The problem with text mode file in Python <3.7 is that it is susceptible to locale setting. The horrible |
Does that matter in this particular context though? (even before 3.7) (we are already opening the main log in text mode...) |
It is probably OK in this context. And now that I am really thinking (Monday mid morning - best thinking time)... Instead of parsing the log, and filtering it, we should just add a custom log handler to the logger when we are in |
Yes I was wondering about that myself. The current method isn't very elegant, but I suppose it doesn't really matter because generating a reference log is a rare thing to do, and doesn't affect users. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change is quick fix for current logic, but we agree that we may want to revisit the logic again in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kinow I would still prefer that you change this as I suggested above, to consistent use of text mode for the two log files involved here, otherwise we may be left wondering in the future if there was some real reason for using binary mode with one and text for the other. @matthewrmshin seemed to agree above that text mode is fine here (I think?).
e9aa151
to
8fec490
Compare
@hjoliver , I hadn't looked around the code when I first suggested the fix. After the comments here, got a cup of coffee and read what the reference log was doing, and @matthewrmshin 's comment about using a Every I tried it locally with ol' suite number five, and got similar output (only the timestamps differ, obviously). So pushed the changes here to see if Travis-CI passes all tests OK. Only issue I actually had was that we cannot initialize the new So the Hope that makes sense? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks @kinow
Not sure if it was better to modify to read binary, but we are doing
line in array_of_strings
... so would have to modify that array too I think. I thought this would be the simplest way to fix it.Added a functional test (my very first!) for this case of
scheduler#shutodown
when--reference-log
is used 👍Not applicable to 7.8.x
Cheers
Bruno