-
-
Notifications
You must be signed in to change notification settings - Fork 746
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
RFR: Add --always-copy option to create_virtualenv method for pack virtual… #2372
Changes from 1 commit
1ea7c45
b938ff0
20fe3cb
30ccc43
ae80051
8f421df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
Configuration options registration and useful routines. | ||
""" | ||
|
||
import os | ||
import sys | ||
|
||
from oslo_config import cfg | ||
|
@@ -41,11 +42,19 @@ def _register_common_opts(): | |
|
||
|
||
def _register_action_runner_opts(): | ||
default_python_bin_path = sys.executable | ||
base_dir = os.path.dirname(os.path.realpath(default_python_bin_path)) | ||
default_virtualenv_bin_path = os.path.join(base_dir, 'virtualenv') | ||
logging_opts = [ | ||
cfg.StrOpt('logging', default='conf/logging.conf', | ||
help='location of the logging.conf file'), | ||
cfg.StrOpt('python_binary', default=sys.executable, | ||
help='Python binary which will be used by Python actions.') | ||
cfg.StrOpt('python_binary', default=default_python_bin_path, | ||
help='Python binary which will be used by Python actions.'), | ||
cfg.StrOpt('virtualenv_binary', default=default_virtualenv_bin_path, | ||
help='Virtualenv binary which should be used to create pack virtualenvs.'), | ||
cfg.ListOpt('virtualenv_opts', default=['--always-copy', '--system-site-packages'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did we verify how much of a difference in terms of virtualenv disk usage There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also googled around a bit and it looks like Because of that we need to make sure the latest confirmed working version of virtualenv and installed and used. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please see StackStorm/st2-packages#53 with regards to disk space requirements. I already pasted the disk spaces there.
Yep. I saw the issue and tested with virtualenv 12.1.1 which was five versions earlier and --always-copy seems to work. dh-virtualenv uses latest virtualenv as far as I can tell so this shouldn't be a problem. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Regarding
It should copy global packages, but since virtualenv is not really relocatable, that just works in some weird way. with --system-site-packages
As we can see this is the list just of a few modules which could be relocated, but this is far from being complete, no anything of that what our without
So what is unique only for origin venv is, and it's not required by github pack!
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, as noted on Slack, we added this a while back as a quick workaround to get things working. I would much prefer to not use this option if possible. For sensors and actions to work though, they also need access to st2common package and all the inherited st2common dependencies (mongoengine, kombu, etc.). If we can get it to work without There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to explaations of @lakshmi-kannan , There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To clarify - the best way to test it is to remove this option, create virtualenv and make sure actions and sensors still work. |
||
help='List of virtualenv options to be passsed to "virtualenv" command that ' + | ||
'creates pack virtualenv.') | ||
] | ||
CONF.register_opts(logging_opts, group='actionrunner') | ||
|
||
|
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.
Ideally we would also include original error message at the end.
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.
The original error message was "No such file or directory" without naming the file. This was confusing. Thus this new message.
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.
But
OSError
doesn't necessary only mean that the file doesn't exist, it could also represent a permissions error, etc. That's why I think it's also good to include the original message somewhere.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.
Ok, let me log the original exception and raise this new one. Does that sound good to you?
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 would prefer to include it in the exception message, but whatever makes you happy :P