Roundup Tracker - Issues

Issue 949864

classification
mod_python interface
Type: Severity: normal
Components: User Interface Versions:
process
Status: closed
:
: richard : a1s, hfoffani, myers_carpenter, richard
Priority: normal : patch

Created on 2004-05-07 13:33 by a1s, last changed 2004-11-20 18:15 by myers_carpenter.

Files
File name Uploaded Description Edit Remove
mp_roundup.py a1s, 2004-05-07 13:33 mod_python interface for Roundup Issue Tracker
mp_roundup.py a1s, 2004-07-04 15:09 mod_python interface - take two
Messages
msg2693 Author: [hidden] (a1s) Date: 2004-05-07 13:33
the attached module is Roundup Web User Interface using
mod_python Apache module.  it must be placed in the
TRACKER_HOME.

i plan to have only one tracker at my site, so this
module does not handle multiple trackers.  support for
multiple trackers may be easily added in the same way
as in cgi-bin or standalone server interfaces. 
alternatively, each tracker may be handled separately
by placing the wrapper in all tracker homes and adding
separate apache sections for each of them.

my tracker resides in /var/db/roundup.  TRACKER_WEB
points to 'https://my.site/roundup/'.  the following
lines were added to httpd.conf:

  #################################################
  # Roundup Issue tracker
  #################################################
  # enable Python optimizations (like 'python -O')
  PythonOptimize On
  # let apache handle static files from 'html' directory
  Alias /roundup/@@file /var/db/roundup/html
  # for roundup-0.6 use '_file' instead of '@@file'
  AliasMatch /roundup/(?!@@file/)(.*)
/var/db/roundup/mp_roundup.py/$1
  # add trailing slash if missing
  RedirectMatch permanent /roundup$ /roundup/
  # handler for /roundup/whatever
  <Directory /var/db/roundup>
    AllowOverride None
    AddHandler python-program .py
    PythonHandler mp_roundup
    # uncomment the following line to see tracebacks in
the browser
    # (note that *some* tracebacks will be displayed
anyway)
    #PythonDebug On
  </Directory>
  # access to static files (.css, .js)
  <Directory /var/db/roundup/html>
    AllowOverride None
    Options None
  </Directory>
msg2694 Author: [hidden] (hfoffani) Date: 2004-06-23 16:14
Logged In: YES 
user_id=112690

I tried this solution with 2 trackers but it doesn't work.
It always brings the data (and apparently the detectors) of 
the first tracker accessed.  When you point the browser to 
the second tracker it brings the data of the first one but the 
html of the second one.

I copied mp_roundup.py on both trackers and in httpd.conf I 
adapted two sections of your sample.

Any ideas?

By the way... It's d@mn fast!
msg2695 Author: [hidden] (hfoffani) Date: 2004-06-23 16:18
Logged In: YES 
user_id=112690

FYI...
python 2.3.2
roundup 0.6.4
Apache 2.0.48
Windows 2000 Pro
mod_python 3.1.3

msg2696 Author: [hidden] (hfoffani) Date: 2004-06-23 16:24
Logged In: YES 
user_id=112690

ups...
and I'm using the standard bdb backend.
msg2697 Author: [hidden] (richard) Date: 2004-06-29 01:22
Logged In: YES 
user_id=6405

The mp_roundup.py script bypasses Roundup's tracker 
instance loading mechanisms. I believe that mod_python has a 
shared module namespace. This means that only one tracker 
will be loaded when imp.load_package() is called and the 
"mod_python_roundup_tracker" name is not changed. 
 
In your second use of the mp_roundup.py script, try changing 
the "mod_python_roundup_tracker" name to something else 
(eg. "another_mod_python_roundup_tracker") 
 
A better solution to this would be for mp_roundup.py to use the 
roundup.instance module to load the tracker, as it deals with 
these namespace collision issues. 
msg2698 Author: [hidden] (a1s) Date: 2004-06-29 07:44
Logged In: YES 
user_id=8719

changing the module name is what i was thinking of.  i just
wanted to test it myself before suggesting.  unfortunately,
i do not have ready-to-use mod_python installation now...

going through roundup.instance really seems to be the right
thing.  Herman, you may try the following patch (untested):

--- mp_roundup.py.orig	2004-06-25 12:41:07.390625000 +0300
+++ mp_roundup.py	2004-06-29 10:40:31.437500000 +0300
@@ -23,9 +23,11 @@
 
 from mod_python import apache
 
+import roundup
+
 import config
 
-TRACKER = imp.load_package("mod_python_roundup_tracker",
config.TRACKER_HOME)
+TRACKER = roundup.instance.open(config.TRACKER_HOME)
 
 class Headers(dict):
 

another possible solution is specifying another
PythonInterpreter for the second tracker.
msg2699 Author: [hidden] (hfoffani) Date: 2004-06-29 08:45
Logged In: YES 
user_id=112690

I did try with a different name but it doesn't work either.
I'll try with roundup.instance.open later.
msg2700 Author: [hidden] (a1s) Date: 2004-06-29 09:02
Logged In: YES 
user_id=8719

if different name did not help, i think that instance.open
won't help, either.

so you have to either use different PythonInterpreter or
instantiate the tracker in the handler function.  the latter
should be slightly slower, but gives considerable memory gain.
msg2701 Author: [hidden] (hfoffani) Date: 2004-06-29 09:31
Logged In: YES 
user_id=112690

As you said, instance.open didn't work. But don't know if this 
was the error you imagined:

Traceback (most recent call last):

  File "D:\Apps\Python23\Lib\site-
packages\mod_python\apache.py", line 287, in 
HandlerDispatch
    log=debug)

  File "D:\Apps\Python23\Lib\site-
packages\mod_python\apache.py", line 457, in import_module
    module = imp.load_module(mname, f, p, d)

  File "D:/Desarrollo/trackers/tareas/\mp_roundup.py", line 30, 
in ?
    TRACKER = roundup.instance.open(config.TRACKER)

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


What do you mean by different PythonInterpreter?

(This is my first shot at mod_python)
msg2702 Author: [hidden] (a1s) Date: 2004-06-29 09:59
Logged In: YES 
user_id=8719

see mod_python manual section 4.1 Multiple Interpreters.
msg2703 Author: [hidden] (hfoffani) Date: 2004-06-29 10:04
Logged In: YES 
user_id=112690

I found PythonInterpreter in mod_python website.
Must spend some time to investigate this.
I'll let you know.
msg2704 Author: [hidden] (hfoffani) Date: 2004-06-30 11:23
Logged In: YES 
user_id=112690

FIXED!
in mp_roundup.py you need:
   import config
   from roundup import instance
   TRACKER = instance.open(config.TRACKER_HOME)

and in httpd.conf:
   PythonInterpreter a_name_for_a_tracker

BTW, No more than 2 o 3 seconds for every roundup 
operation!!!!
msg2705 Author: [hidden] (a1s) Date: 2004-07-04 15:09
Logged In: YES 
user_id=8719

i've moved tracker lookup to the request handler.
tracker home is now specified in apache config:

<Directory /usr/roundup/classic>
  AllowOverride None
  AddHandler python-program .py
  PythonHandler roundup.cgi.mp_roundup
  PythonOption TrackerHome /usr/roundup/classic
</Directory>

i've got no collision by running two such trackers from the
same PythonInterpreter.

keeping mp_roundup in the tracker home makes no sense
anymore.  in above config snippet you can see that this time
i have run mp_roundup.py installed into the roundup package.

Richard, ain't it time to add this to CVS repository?
msg2706 Author: [hidden] (richard) Date: 2004-07-04 21:40
Logged In: YES 
user_id=6405

Go for it :) 
msg2707 Author: [hidden] (hfoffani) Date: 2004-07-05 15:49
Logged In: YES 
user_id=112690

Thanks Alex.
It's also working here too. (Apache on Windows 2K)
Would you include some explanations in the INSTALL file? It 
would help a lot as Apache's httpd.conf knowledge is beyond 
normal expertise.
msg2708 Author: [hidden] (a1s) Date: 2004-07-06 11:42
Logged In: YES 
user_id=8719

checked in.
msg2709 Author: [hidden] (myers_carpenter) Date: 2004-11-20 18:15
Logged In: YES 
user_id=335935

Is there any reason this isn't yet in CVS?
msg2710 Author: [hidden] (myers_carpenter) Date: 2004-11-20 18:16
Logged In: YES 
user_id=335935

My bad.  I see that it is. roundup/cgi/apache.py
History
Date User Action Args
2004-05-07 13:33:31a1screate