← Back to team overview

launchpad-dev team mailing list archive

Re: combo loader update

 

tl;dr;
Success.
Non-obvious (to me) import issue resolved in
lp:~wallyworld/launchpad/use-combo branch, the symptoms of which were
that Launchpad's sitecustmize module could not be imported and stuff broke.

Branch is fixed and running though ec2 test nicely. I've also submitted
an RT (50444) to get the buildbots updated so that this branch can be
landed. We can't land till this RT is acted on.

You guys and gals will also need to (from memory):

sudo apt-get upgrade launchpad-developer-dependencies

in order to be able to build. This installs convoy basically. We are
still working on getting the deployment side sorted for prod. If you
want to actually run locally with the combo loader, once the branch
lands, you will need to:

sudo apt-get install libapache2-mod-wsgi
sudo make copy-apache-config
and
turn on the js.combo_loader.enabled feature flag.

Once this branch lands, we'll resend the "official" instructions. The
above is a guide :-)

****************

Now the long bit.....

First, the symptom - running any Python related task from the Launchpad
bin directory (eg bin/py, bin/test, bin/run etc) would result in a
message being printed on the console:

'import sitecustomize' failed; use -v for traceback

This turned out to be a "non fatal" error - running Launchpad worked, or
tests passed (so long as they were not doc tests of course). Looking
into the failure, here's where the error was thrown:

if process_name is None:
  process_name = os.path.splitext(os.path.basename(sys.argv[0]))[0]

The above code is from LaunchpadConfig.__init__. $10000 for whoever can
guess what the error raised was.

AttributeError: 'module' object has no attribute 'argv'

Yes, it was claiming that module sys has no argv attribute. And sure
enough, doing a "print dir(sys)" showed that argv is gone. WTF. I'd love
to know what could possibly cause something to effectively execute what
appears to be "del sys.argv".

What caused it? Well, in lp.services.webapp.publisher is a new
LaunchpadView property:

    @property
    def yui_console_debug(self):
        """Hide console debug messages in production."""
        return 'true' if config.devmode else 'false'

If I move the import (config is an instance of LaunchpadConfig):

from lp.services.config import config

to live inside the yui_console_debug() method, everything is ok again.
So, recall I wrote above that the code which raised is inside the
__init__ of LaunchpadConfig, and that's the import we are moving. So it
makes sense from that perspective, but why is it claiming that sys no
longer has an argv attribute?

Oh well. Sorted now, but any clues to stop me going WTF over and over?



Follow ups

References