Use:

  import mod_wsgi

  if mod_wsgi.process_group == 'mytasks':
    ...

IOW, conditional on name of process group.

Graham

On 10 October 2011 23:35, Kent <[email protected]> wrote:
> One more question: I would want this standalone process to load the same
> application so that it has the same setup/model, etc.
>
> Is there a Directive I can use to pass a parameter to the python script so I
> can tell the "special" process it is allowed to load the scheduler?  Or
> would I use WSGICallableObject to accomplish this?
>
>
> On 10/7/2011 6:16 PM, Graham Dumpleton wrote:
>>
>> Create a dummy daemon process group and preload a Python script file
>> into it to do the background thread. No URLs would ever be mapped to
>> the daemon process.
>>
>>   WSGIDaemonProcess mysite processes=3 threads=3
>>   WSGIScriptAlias / /some/path/mysite.wsgi process-group=mysite
>>
>>   WSGIDaemonProcess mytasks processes=1 threads=1
>>   WSGIImportScript /some/path/mytasks.py process-group=mytasks
>> application-group=%{GLOBAL}
>>
>> The threads=1 to mytasks is just to cut down on request threads that
>> aren't going to be used anyway.
>>
>> Graham
>>
>> On 8 October 2011 08:52, Kent<[email protected]>  wrote:
>>>
>>> Suppose I am running in a multiprocess environment but would like to
>>> run a "scheduler".  Of course, each process starts its own scheduler,
>>> so I end up with this running once for each process.
>>>
>>> Can you think of a way around this?  I only want one process to start
>>> the scheduler....
>>>
>>> import tgscheduler
>>> import logging
>>> log = logging.getLogger(__name__)
>>>
>>> def kent():
>>>    log.info("run")
>>>
>>> tgscheduler.start_scheduler()
>>> tgscheduler.add_interval_task(kent,15, initialdelay=30)
>>>
>>> Any ideas?
>>>
>>>
>>> Thanks,
>>> Kent
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "modwsgi" group.
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/modwsgi?hl=en.
>>>
>>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "modwsgi" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/modwsgi?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"modwsgi" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/modwsgi?hl=en.

Reply via email to