Fixing long PYTHONPATH and the resulting performance issues #997
Replies: 5 comments 4 replies
-
I'm keen to try this out! One thing: It might be useful to expose the already existing temporary context dir in package commands. That way you could create your temp dir within that, so it gets cleaned up when the context exits. |
Beta Was this translation helpful? Give feedback.
-
Very clever! I imagine this could really improve user experience with certain python-based command-line utilities... I often set PYTHONUSERBASE in |
Beta Was this translation helpful? Give feedback.
-
I seem to remember that we did something similar at Animal Logic - @fnaum might be able to comment on whether it's still used and how well it does (or doesn't) work. Our trigger for doing this was hitting a limit in Maya; once the PYTHONPATH reached 4096 characters long a .so in Maya began to reject it (I want to say it was something to do with flexlm) and Maya refused to start. We didn't follow your approach exactly (at the time anyway) as When do the temporary directories get cleaned up, I think Would you also look to apply this to other packages that are managed through a |
Beta Was this translation helpful? Give feedback.
-
Hi, Hey @mstreatfield you are correct, AL implementation is different, it creates a temp folder, and then it goes thru all the directories in order of the Regarding, On the other hand, we have been using the flattening of @nerdvegas I think we have a good reason behind creating and not cleaning it up right away. I remember we did something explicit to prevent the cleanup of those directories (on maya/houdini/nuke environments) and left the cleanup up to system level to delete them when they are X days old. I'll try to dig on the old docs to see If I can share the exact reason why that was needed. Fede |
Beta Was this translation helpful? Give feedback.
-
Were there any plans to build this into rez sometime in the future? |
Beta Was this translation helpful? Give feedback.
-
Hi all,
when using many python packages in a resolve there are two very common issues (on windows at least):
For reference, with a set of 100 test packages that do nothing except for being importable starting python takes 18s (with a local python to reduce the impact of python itself).
The proposed fix reduces this time to 1.8s.
Credits: This approach was originally created by our VFX department. Kudos.
I would like other people to test this and discuss any potential disadvantages or problems this approach might cause.
The basic approach is as follows:
This can be applied using different ways. Specifically it could be part of the python package itself, or for testing as we did for now as a separate package doing the above in post_commands. Here is a sample implementation of said post_commands function:
Any thoughts, tests, feedback would be greatly appreciated. This can also serve as a test for the new GitHub discussions :)
Beta Was this translation helpful? Give feedback.
All reactions