Added functionality to lock projects during work packages script run.#49
Conversation
| try: | ||
| server_version = wp_info["version"] | ||
| except KeyError: | ||
| server_version = None |
There was a problem hiding this comment.
why we need this try/except block? isn't it a must that the wp project exists already?
| executor.map(push_work_package, wp_config.wp_names) | ||
| for result in executor.map(push_work_package, wp_config.wp_names): | ||
| if result: | ||
| print(result) |
There was a problem hiding this comment.
not sure if I understand this change - push_work_package does not seem to return anything - so what are we printing here?
There was a problem hiding this comment.
This is result of threads executor. If for example there will be exception raised in any thread then we won't be aware of it withour results inspection and exception will be passed silently.
There was a problem hiding this comment.
I see - it may be worth adding a comment there with an explanation - so that someone like me does not remove it in the future as being no operation.
And do we need to print it? I guess if there's no exception, this is producing a series of None lines on the standard output. Isn't there a way to just check for exception?
I believe we should be able to get the exceptions just like this:
for result in executor.map(push_work_package, wp_config.wp_names):
pass # nothing to do here, just evaluating results so we get exceptions if any were thrownThere was a problem hiding this comment.
If there will be an error then result will be instance of Exception object (but not raised automatically in a main thread). In case of success there will be just None returned by push_work_package function. So errors will be printed and None values will be ignored.
No description provided.