-
Notifications
You must be signed in to change notification settings - Fork 3k
Fixed/improved error parsing from API messages. #3922
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
Conversation
Fixed results output summary. General tidy up of long lines. Added a new field to json file, target_list, to allow the user to override the set of targets used for the compilation.
@theotherjimmy @bridadan please review. As well as the fixes added, incorporated the stylistic changes previously mentioned. |
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! I'm always down for linting. Any chance we can start unit testing this script?
tools/check_release.py
Outdated
if response['result']['data']['task_complete']: | ||
|
||
|
||
data = response['result']['data'] |
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.
Agreed. Nested json stuff can get gross.
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.
Maybe a better name than data
. but it matches the key...
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.
Are we garenteed to have response['result']['data']
here? it might be worth a try:
except KeyError:
or similar. Not blocking, but maybe we should consider it...
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.
@theotherjimmy I believe it's a guaranteed response field
tools/check_release.py
Outdated
@@ -270,7 +300,7 @@ def upgrade_test_repo(test, user, library, ref, repo_path): | |||
|
|||
os.rename(lib_file, bak_file) | |||
else: | |||
logging.error("!! Error trying to backup lib file prior to updating.") | |||
logging.error("!! Failure to backup lib file prior to updating.") |
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.
Maybe drop the !!
here as well? It's kind of silly when we already do logging.error
.
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.
Yeah will do
tools/check_release.py
Outdated
@@ -362,11 +394,22 @@ def get_latest_library_versions(repo_path): | |||
|
|||
return mbed, mbed_dev | |||
|
|||
def log_results(lst, title): | |||
logging.info(title) |
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.
We should do the title
and lst
as one statement here. Otherwise it looks weird on the output.
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.
@theotherjimmy I don't understand your comment ? lst is checked for being empty (in which case output 'none', otherwise we need to iterate through the list printing entries . Are you suggesting printing title on every list entry line ?
E.g something more like:
FAILED: example_app
FAILED: other_example_app
SKIPPED: this_app
?
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.
Yes. I was thinking something like that. This would make it trivial to grep for failures/skipps/passes in a log file.
tools/check_release.py
Outdated
|
||
passes += (int)(result) | ||
break | ||
else: | ||
logging.error("\t\tProgram/Target compilation failed due to internal errors. Removing from considered list!\n") | ||
logging.error("\t\tCompilation failed due to internal errors.\n") | ||
logging.error("\t\tSkipping test/target combination!\n") |
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.
Can we drop the \t\t
? If you want speciallized output styling there is always Config options.
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.
I don't think the config option do what I was intending. ie to make it stand out more to the human eye, but I don't really care that much to quibble about it !
tools/check_release.py
Outdated
|
||
logging.info(" SUMMARY OF COMPILATION RESULTS") | ||
logging.info(" ------------------------------\n") |
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.
Maybe drop the \n
here? we already get a newline by calling logging.
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.
Same comment as previous, as to human eye readability . but again I don't really care that much..
Another requst: could we use something other than the root logger? |
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.
LGTM, I agree with @theotherjimmy's feedback and noted one thing below. Not a blocker
tools/check_release.py
Outdated
json_data = json.load(open(os.path.join(os.path.dirname(__file__), "check_release.json"))) | ||
|
||
json_data = json.load(open(os.path.join(os.path.dirname(__file__), | ||
"check_release.json"))) |
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.
We should probably close the file after opening it for reading.
json_file = open(os.path.join(os.path.dirname(__file__), "check_release.json"))
json_data = json.load(json_file)
json_file.close()
Or you can always do:
json_data = None
with open(os.path.join(os.path.dirname(__file__), "check_release.json")) as json_file:
json_data = json.load(json_file)
or something similar
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.
Ahhhh!!! data
?! you want to call it DATA!
It would actually be
with open(os.path.join(os.path.dirname(__file__), "check_release.json")) as config:
json_data = json.load(config)
Also, open files that are leaked (not really gced language) are closed when gced. This is generally pretty safe, but the timing of closing the file descriptor can be wonky.
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.
I edited after you posted it so now you look silllly! Muhahaha
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.
lol. good evil laugh.
whats the status of this patch? Once updated, please restart uvisor (if it does not retrigged by itself). |
…inor formatting updates.
@theotherjimmy @bridadan please re-review |
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.
Good changes! Though wouldn't the rel_log
instance have to be declared at the top of the file? Or am I totally in the wrong on how Python scoping works?
json_data = json.load(open(os.path.join(os.path.dirname(__file__), "check_release.json"))) | ||
|
||
|
||
with open(os.path.join(os.path.dirname(__file__), "check_release.json")) as config: |
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.
Lovely 😄
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.
It seems to work fine using the rel_log instance globally , so not sure !!
@marhil01 @SeppoTakalo Hi guys, looks like we are getting Oulu CI failures for unrelated issues to the PR under test ?? |
@theotherjimmy @bridadan Hold fire for a little while on the re-review as I have another change I want to bring in (to add support for an ignore list ie a list of test, target to ignore when running through the compilation set) |
@theotherjimmy @bridadan ok good to go on the re-review thanks |
@marhil01 @SeppoTakalo Looks like a Raas demon problem:
Can you help please? |
@theotherjimmy Can you list changes needed here or approve? |
I thought I approved it. @sg- no changes requested at this time. |
Fixed results output summary.
General tidy up of long lines.
Added a new field to json file, target_list, to allow the user to
override the set of targets used for the compilation.