Skip to content

Added functionality to lock projects during work packages script run.#49

Merged
wonder-sk merged 6 commits into
mainfrom
lock_projects_during_run
Mar 9, 2023
Merged

Added functionality to lock projects during work packages script run.#49
wonder-sk merged 6 commits into
mainfrom
lock_projects_during_run

Conversation

@ldebek

@ldebek ldebek commented Feb 15, 2023

Copy link
Copy Markdown
Contributor

No description provided.

@ldebek ldebek requested a review from wonder-sk February 15, 2023 12:58
Comment thread workpackages/wp_mergin.py
try:
server_version = wp_info["version"]
except KeyError:
server_version = None

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why we need this try/except block? isn't it a must that the wp project exists already?

Comment thread workpackages/wp_mergin.py
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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

not sure if I understand this change - push_work_package does not seem to return anything - so what are we printing here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 thrown

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Comment thread workpackages/wp_utils.py
Comment thread workpackages/wp_utils.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants