By the way, eager to see the outcome of this thread (pun intended). On Jun 11, 2013 11:46 PM, "Graham Dumpleton" <[email protected]> wrote:
> Is the issue that you are expecting to see it started when Apache is > started. > > By default mod_wsgi will lazily load the WSGI script on the first request. > This may be why you only see it then. > > Can you show me how you are configuring mod_wsgi? Eg., WSGIScriptAlias, > WSGIDaemonProcess, WSGIProcessGroup directives etc. > > Having that can then show you how to tweak it to preload WSGI script when > Apache first starts. > > Graham > > On 12/06/2013, at 2:27 AM, Josh Nathanson <[email protected]> wrote: > > On Mon, Jun 10, 2013 at 8:09 PM, Graham Dumpleton < > [email protected]> wrote: > >> On 11/06/2013, at 11:13 AM, Josh Nathanson <[email protected]> >> wrote: >> >> Hi Graham, thanks for responding so quickly. >> >> On Mon, Jun 10, 2013 at 6:03 PM, Graham Dumpleton < >> [email protected]> wrote: >> >>> Where are you starting the thread from? >>> >> >> The thread is started in the main() function of the Pyramid app, like so: >> >> def main(global_config, **settings): >> # AMQPClient extends Thread >> amqp_client = amqp_client = AMQPClient(settings['amqp.host']) >> amqp_client.start() >> >> >> And you have added print statements inside of that main() function to see >> if it is executed? >> >> When running under mod_wsgi, the typical main() function that a web >> application has to run a specific embedded WSGI server would not be run, >> especially since such main() functions are only run if __name__ == >> '__main__', which wouldn't be the case under mod_wsgi. >> >> Can you provide more of the WSGI script file so I can see how when that >> main() is run? >> >> Graham >> > > > Hi Graham, > > I added some print statements to the main function as you suggested, and > lo and behold, it is not run when Apache is started up. It seems like it > is only run after the first http request hits the application. After that > the subthread starts up fine and works as expected. I'm wondering if there > is some way to get that function to fire, (or some function that can start > the subthread), other than faking a request to the application? > > For reference the WSGI script file looks like this, it's very brief: > > ------ > from pyramid.paster import get_app > > application = get_app('/path/to/config.ini', 'main') > ------ > > Thanks again for your assistance. > > -- Josh > > > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/modwsgi?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > > > -- > You received this message because you are subscribed to the Google Groups > "modwsgi" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/modwsgi?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "modwsgi" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/modwsgi?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
