Skip to content
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

Various Python 3 related fixes and changes #4424

Merged
merged 17 commits into from
Nov 5, 2018
Merged

Various Python 3 related fixes and changes #4424

merged 17 commits into from
Nov 5, 2018

Conversation

Kami
Copy link
Member

@Kami Kami commented Nov 5, 2018

I uncovered some more Python 3 related issues while working on Bionic pacakges.

This pull request includes the following changes / fixes:

  1. Add missing st2garbagecollector service to launchdev script
  2. Fix launchdev script so it actually uses VIRTUALENV environment variable - this allows people to use it with a Python 3 virtual environment
  3. Fix st2-pack-install so it works under Python 3
  4. Make sure we run pack tests on Travis under Python 3
  5. Correctly pass timezone kwarg to BlockingScheduler class constructor

@Kami Kami added the python3 label Nov 5, 2018
@Kami Kami added this to the 3.0.0 milestone Nov 5, 2018
Kami added 6 commits November 5, 2018 12:45
registered as common options inside st2common.
advertised.

We advertise "timersengine" section as new and preferred way of
configuring timers engine service and "timer" config options are
deprecated.

Because of the way how the code was structured[1], even if user would
specify only "timersengine" section in st2.conf, those options would
not be used, but default options from config.py for "timer" section
would be used.

This pull request fixes that to work as advertised / inteded - "timer"
section should only be used if explicitly specified in st2.conf and
timersengine should have precedence over it.

[1]: https://github.com/StackStorm/st2/blob/0245a18198babafe2ab0abde31791cf526435234/st2reactor/st2reactor/cmd/timersengine.py#L59
@Kami
Copy link
Member Author

Kami commented Nov 5, 2018

And for people who want to test Python 3 stuff locally, they can now do this:

make requirements
source virtualenv/bin/activate # this is needed to ensure latest version of virtualenv binary is used by Python 3 aka Python 2 virtual environment needs to exist already
PYTHON_VERSION=python3.6 VIRTUALENV_DIR=virtualenv-py3 make requirements
source virtualenv-py3/bin/activate
VIRTUALENV=virtualenv-py3  ./tools/launchdev.sh start

This will create a new virtual environment using Python 3.6 binary and start all the services using this new virtual environment.

Keep in mind that this command requires Python 3.6, python3-virtualenv, etc. be installed on the system.

@@ -13,7 +13,7 @@ else
VIRTUALENV_ST2CLIENT_DIR ?= virtualenv-st2client
endif

PYTHON_VERSION = python2.7
PYTHON_VERSION ?= python2.7
Copy link
Contributor

Choose a reason for hiding this comment

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

Wow. Things you learn :)

# NOTE: "timer" section will be removed in v3.1
timer_opts = [
cfg.StrOpt(
'local_timezone', default=None,
Copy link
Contributor

Choose a reason for hiding this comment

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

I read the original code and default=True for both timers and timersengine was pretty dumb on my part. I now get what you mean. Good catch.

@Kami Kami merged commit 3ac37d0 into master Nov 5, 2018
@Kami Kami deleted the fix_py3_issues branch November 5, 2018 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants