Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

General: Fix finding of last version #3656

Merged
merged 12 commits into from
Aug 16, 2022

Conversation

antirotor
Copy link
Member

Bug

There was a bug that affected finding of last OP version. This resulted in invalid behaviour mainly in headless mode, where it tries to reinstall already installed version.

@antirotor antirotor added type: bug Something isn't working Bump Minor Pull requests that update a dependency file labels Aug 12, 2022
@antirotor antirotor self-assigned this Aug 12, 2022
@BigRoy
Copy link
Collaborator

BigRoy commented Aug 12, 2022

This would require deploying new executables/installers, yes? :)

Were you able to reproduce the original issue of it trying to do a force install in headless mode? And did this avoid it on your end? Just wondering how "safe" it is for me to just throw this PR into production to see if it'd would fix the issue or whether this might do more harm.

@antirotor
Copy link
Member Author

This still needs little refactor to move the compatibility check out...

@antirotor
Copy link
Member Author

This would require deploying new executables/installers, yes? :)

yes, this will need new build

Were you able to reproduce the original issue of it trying to do a force install in headless mode? And did this avoid it on your end? Just wondering how "safe" it is for me to just throw this PR into production to see if it'd would fix the issue or whether this might do more harm.

I haven't reproduced it, but find similar issue with headless mode that lead me to this. The re-install logic is sound I think, problem is that it can't find the latest version correctly so it is trying to reinstall it.

But please wait with deployment until the compatibility check is refactored.

@BigRoy
Copy link
Collaborator

BigRoy commented Aug 12, 2022

But please wait with deployment until the compatibility check is refactored.

If you could ping me when that's the case, please do so! :)
We'll need this fix asap since it seems to break systems for our artists too.

Comment on lines 513 to 526
# if the item is directory with major.minor version, dive deeper
try:
ver_dir = item.name.split(".")[
0] == installed_version.major and \
item.name.split(".")[
1] == installed_version.minor # noqa: E051
if item.is_dir() and ver_dir:
_versions = OpenPypeVersion.get_versions_from_directory(
item)
if _versions:
openpype_versions.append(_versions)
except IndexError:
pass
# if file exists, strip extension, in case of dir don't.
Copy link
Collaborator

@BigRoy BigRoy Aug 12, 2022

Choose a reason for hiding this comment

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

Wouldn't the item.name match exactly with f"{installed_version.major}.{installed_version.minor}"?
So wouldn't this just be if item.name == f"{installed_version.major}.{installed_version.minor}" or alike?

Should be faster too, and more readable. Less string splitting and just a single comparison. major_minor could even be defined outside of the iterdir() loop.

major_minor = f"{installed_version.major}.{installed_version.minor}"
if item.is_dir() and item.name == major_minor:
    _versions = OpenPypeVersion.get_versions_from_directory(item)
    openpype_versions.extend(_versions)

I also expected this should be openpype_versions.extend() instead of append when looking at the code?

And shouldn't we also "continue" if we've already identified it as a major minor subfolder, so add

    continue

Copy link
Member Author

@antirotor antirotor Aug 12, 2022

Choose a reason for hiding this comment

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

this is actually wrong as it shouldn't compare those at all and dive deeper if it matches regex ^\d+\.\d+$

@BigRoy
Copy link
Collaborator

BigRoy commented Aug 16, 2022

We have deployed this in production now. (Since this requires the build/install to be updated too I've actually batch removed the old install and then batch deployed the new to make sure it's using this newer build logic.)

So far so good in Deadline. If anything pops up with errors I'll report back.

@iLLiCiTiT
Copy link
Member

Added UI message if installed version is not compatible with zip and is not launched in headless mode.

@antirotor
Copy link
Member Author

Added UI message if installed version is not compatible with zip and is not launched in headless mode.

It works.

@antirotor antirotor merged commit 08e3519 into release/3.14.x Aug 16, 2022
@antirotor antirotor deleted the bugfix/fix-finding-last-version branch August 16, 2022 14:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bump Minor Pull requests that update a dependency file type: bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants