Hi Niphlod,

     I changed my .conf file a littile by reading the web2py online book,

    

    Created a new web2py-scheduler.conf file

   
    start on runlevel [2345]
        
    stop on runlevel [016]
    respawn limit 8 60
   
    script
          exec sudo -u root python /srv/tv-fe/web2py.py -K app
    end script
  
    respawn

   and another conf file tv-fe.conf

 
  start on runlevel [2345]
  # When to stop the service
  stop on runlevel [016]
   
  # Automatically restart process if crashed
  respawn
  respawn limit 5 60
  
  # Specify resource limits
  # Make sure you have set the system limits accordingly
  limit nofile 65536 65536
  
  # Modify scheduling priority, ranges from -20 (most favorable) to 19 
(least
  # favorable)
  nice -10
  
  # Out Of Memory (OOM) killing score, ranges from -999 (very unlikely to be
  # killed by OOM killer) to 1000 (very likely) or 'never'
  oom score -555
  
  # Essentially lets upstart know the process will detach itself to the 
background
  expect fork
  expect daemon
  
  # Run before process
  pre-start script
      [ -d /var/log/tv/frontend ] || mkdir -p /var/log/tv/frontend
  end script
  
  # Start the process
  script
      exec python -- /srv/tv-fe/web2py.py --nogui -a '' -p 8000 -i 0.0.0.0  
&
  end script

The log from the upstart web2py-scheduler.log is 
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2013
Version 2.2.1 (2012-10-21 16:57:04) stable
Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
PostgreSQL(pg8000), IMAP(imaplib)
starting single-scheduler for "app"...
/usr/local/lib/python2.7/dist-packages/riak-2.0.1.post5-py2.7.egg/riak/util.py:148:
 
UserWarning: ``solr`` is deprecated, use ``fulltext_search``, 
``fulltext_add`` and ``fulltext_delete`` directly
  value = self.fget(obj)


the tv-fe.log is 

ubuntu@ip-XX-X-X-XX:/var/log/upstart$ sudo tail -f tv-fe.log
  value = self.fget(obj)
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2013
Version 2.2.1 (2012-10-21 16:57:04) stable
Database drivers available: SQLite(sqlite3), MySQL(pymysql), 
PostgreSQL(pg8000), IMAP(imaplib)
2013-09-11 11:38:54,936 - WARNING - web2py - GUI not available because Tk 
library is not installed
no password, no admin interface
please visit:
http://0.0.0.0:8000
use "kill -SIGTERM 11998" to shutdown the web2py server



/usr/local/lib/python2.7/dist-packages/riak-2.0.1.post5-py2.7.egg/riak/util.py:148:
 
UserWarning: ``solr`` is deprecated, use ``fulltext_search``, 
``fulltext_add`` and ``fulltext_delete`` directly
  value = self.fget(obj)

Entry in the scheduler worker table
>>> workers = db(db.scheduler_worker).select()
>>> for each in workers:
...   print each
... 
<Row {'status': 'ACTIVE', 'first_heartbeat': datetime.datetime(2013, 9, 11, 
11, 39, 10), 'is_ticker': False, 'worker_name': 'ip-10-0-0-13#12026', 
'group_names': ['main'], 'last_heartbeat': datetime.datetime(2013, 9, 11, 
11, 43, 46), 'id': 1}>


Entry in the scheduler_task table

<Row {'vars': '{}', 'period': 600, 'group_name': 'main', 'times_failed': 0, 
'id': 1, 'last_run_time': None, 'uuid': 
'67263a73-c086-45e0-9c38-23c892af95c7', 'stop_time': None, 'retry_failed': 
3, 'function_name': 'total_devices', 'status': 'QUEUED', 'timeout': 300, 
'start_time': datetime.datetime(2013, 9, 11, 11, 41), 'args': '[]', 
'next_run_time': datetime.datetime(2013, 9, 11, 11, 43, 10), 'enabled': 
True, 'sync_output': 0, 'times_run': 0, 'task_name': 'total_devices', 
'application_name': 'app/default', 'repeats': 0, 'assigned_worker_name': 
''}>


am I doing it the correct order, if yes then why doesnt the worker pickup 
the task. I am not sure whether the conf files I have created is right.

I run the services as 

sudo service tv-fe start
sudo service web2py-scheduler start





On Tuesday, 10 September 2013 23:34:56 UTC+5:30, Niphlod wrote:
>
> you may be missing some bits..... on production nginx acts as a proxy 
> between uwsgi and the web....you don't need (again, usually) web2py to 
> start its own webserver.... the -X switch is only useful if you want a 
> single commandline to start BOTH the scheduler and the webserver, and it's 
> meant to be used only in development.
>
> Usually you'd have uwsgi serving the "web part" and a script to run the 
> scheduler (hence, just web2py.py -K appname) .
> BTW, upstart creates logs by default that are named after the servicename, 
> so something like /var/log/upstart/yourservicename.log gets created: you 
> may inspect that to see what is going on your server.
>
> On Tuesday, September 10, 2013 3:28:13 PM UTC+2, ajith c t wrote:
>>
>> ok i will try making two separate services. and which log are you 
>> checking out, I maintain my custom logging mechanism. The only thing that 
>> comes in it is 
>>
>> DEBUG - web2py.scheduler - defining tables (migrate=True)
>>
>> the app doesnt assign a worker in the scheduler_task table. The column 
>> shows a NULL value. 
>>
>> I am using nginx, when I remove the -X parameter it results in a bad 
>> gateway,
>>
>>
>>
>> On Tuesday, 10 September 2013 18:21:36 UTC+5:30, Niphlod wrote:
>>>
>>> why don't you schedule two separate services (the webserver and the 
>>> scheduler), so the issues will be easier to track down ? what's in the logs 
>>> ?
>>>
>>> On Tuesday, September 10, 2013 1:42:11 PM UTC+2, ajith c t wrote:
>>>>
>>>> Hi All,
>>>>
>>>>       I have a scheduler in my app in the models folder with some 
>>>> specific task. I need to run the app as a service in the server. I cant 
>>>> figure out how to run start the web2py with the arguments.
>>>>
>>>>
>>>> script
>>>>      exec python -- /srv/tv-fe/web2py.py -K app -X --nogui -p 8000 -i 
>>>> 0.0.0.0 -a ''   &
>>>> end script
>>>>
>>>> The above script is used to run the app. Upon running it , it doesnt 
>>>> generate error, but the worker is not created in the scheduler_worker 
>>>> table. So none of my task gets executed.
>>>>
>>>> Where am I getting wrong with the parameters
>>>>
>>>> Thanks and regards
>>>> Ajith
>>>>
>>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to