uhm. as long as in your modules don't do something like from datetime import datetime
it should all be fine.... Scheduler just calls datetime.datetime.now() or datetime.datetime.utcnow() , so if you don't "overwrite" the datetime "root" module with the "child" one as in from datetime import datetime it should give you no errors.... On Wednesday, June 19, 2013 3:14:24 PM UTC+2, Joe Barnhart wrote: > > Hi Niphlod -- > > The culprit seems to be the handling of "datetime" in the function "now" > in scheduler.py. If I import datetime within the scope of "now" it works > fine. I could submit a patch once I get into a place that actually has > internet. > > -- Joe > > On Monday, June 17, 2013 11:43:09 PM UTC+8, Niphlod wrote: >> >> the "error on popping task" is shown as soon as an exception is raised >> into the wrapped_pop_task() function. You can remove the try:except block >> to see what's the underlying error, but I really don't know what it could >> be just watching at logs. >> >> Il giorno lunedì 17 giugno 2013 15:18:54 UTC+2, Joe Barnhart ha scritto: >>> >>> Hi Niphlod -- >>> >>> I can start with debugging... Here is the output: >>> >>> root@groomlake2:~# python /home/www-data/web2py/web2py.py -K >>> swim_smarter -D 0 >>> web2py Web Framework >>> Created by Massimo Di Pierro, Copyright 2007-2013 >>> Version 2.5.1-stable+timestamp.2013.06.06.15.39.19 >>> Database drivers available: SQLite(sqlite3), MySQL(pymysql), PostgreSQL( >>> psycopg2), PostgreSQL(pg8000), IMAP(imaplib) >>> starting single-scheduler for "swim_smarter"... >>> DEBUG:web2py.dal:Your database version does not support the JSON data >>> type (using TEXT instead) >>> DEBUG:web2py.scheduler.groomlake2#5474:defining tables (migrate=True) >>> DEBUG:web2py.scheduler.groomlake2#5474:thread building own DAL object >>> DEBUG:web2py.scheduler.groomlake2#5474:looping... >>> ERROR:web2py.scheduler.groomlake2#5474: error popping tasks >>> DEBUG:web2py.dal:Your database version does not support the JSON data >>> type (using TEXT instead) >>> DEBUG:web2py.scheduler.groomlake2#5474:defining tables (migrate=False) >>> ERROR:web2py.scheduler.groomlake2#5474:Error retrieving status >>> ERROR:web2py.scheduler.groomlake2#5474: error popping tasks >>> ERROR:web2py.scheduler.groomlake2#5474: error popping tasks >>> ERROR:web2py.scheduler.groomlake2#5474: error popping tasks >>> ERROR:web2py.scheduler.groomlake2#5474: error popping tasks >>> ERROR:web2py.scheduler.groomlake2#5474: error popping tasks >>> ERROR:web2py.scheduler.groomlake2#5474: error popping tasks >>> ERROR:web2py.scheduler.groomlake2#5474:Error retrieving status >>> ERROR:web2py.scheduler.groomlake2#5474: error popping tasks >>> ERROR:web2py.scheduler.groomlake2#5474: error popping tasks >>> ERROR:web2py.scheduler.groomlake2#5474: error popping tasks >>> DEBUG:web2py.scheduler.groomlake2#5474:sleeping... >>> ERROR:web2py.scheduler.groomlake2#5474:Error retrieving status >>> ^CINFO:web2py.scheduler.groomlake2#5474:catched >>> INFO:web2py.scheduler.groomlake2#5474:die! >>> >>> I saw the migrate=True stuff and went and switched off all migrates but >>> the error remained. >>> >>> I also think it is odd the error is about "popping tasks" because the >>> tasks table has no entries at all -- nor does the run table or the worker >>> table. All three schduler tables are completely empty. >>> >>> As for real-time debugging this, I'm in Malaysia this week on a biz >>> trip. (I'm so jet-lagged I don't think I can find my head with both hands!) >>> >>> -- Joe >>> >>> On Sunday, June 16, 2013 8:20:16 PM UTC+8, Niphlod wrote: >>>> >>>> never run the scheduler with sqlite database, if you're planning to >>>> launch multiple schedulers. SQLite and concurrency don't go along very >>>> well. >>>> If your app accesses the postgresql database it should be able to >>>> connect as well from the scheduler, it's true, but evidently something is >>>> different between your "web" environment and your "scheduler" one. >>>> PS: can you start the scheduler with web2py.py -K appname -D 0 ? >>>> -D 0 enables DEBUG logs and we maybe able to see the "something" that >>>> is not working. >>>> If you can't come up with a solution, I'm available to do some >>>> debugging, send me a PM. >>>> >>>> On Sunday, June 16, 2013 9:08:33 AM UTC+2, Joe Barnhart wrote: >>>>> >>>>> Good points. >>>>> >>>>> But since I'm running the same application in the web server, and it >>>>> can see and read/write the PostgreSQL database from the web process, does >>>>> that imply that the scheduler process (which uses all the same files) can >>>>> see the database as well? If there is nu such assumption, how would I go >>>>> about proving access from the scheduler process? >>>>> >>>>> As an aside, I tried running the scheduler as root and as www-data >>>>> (the owner and group of all the web2py files). They both resulted in the >>>>> same errors. I was thinking about changing the scheduler to run its >>>>> tables >>>>> in SQLite and keep the application in PostgreSQL. Would that be tempting >>>>> the fates to throw down more anguish on me? >>>>> >>>>> -- Joe >>>>> >>>>> On Saturday, June 15, 2013 9:56:37 PM UTC+8, Niphlod wrote: >>>>>> >>>>>> scheduler and whatever you choose to run your "web part" are totally >>>>>> unrelated. It's meant to be as a separate process, and can totally run >>>>>> on >>>>>> its own. What you need to check is that the scheduler instance can >>>>>> connect >>>>>> to the database (if this was a result of permission problems on the >>>>>> file, >>>>>> the breakage should have happened before those logs, e.g. reading the >>>>>> source file of web2py.py). >>>>>> >>>>>> On Saturday, June 15, 2013 4:20:14 AM UTC+2, Joe Barnhart wrote: >>>>>>> >>>>>>> I'm trying to set up a test server that's close to the production >>>>>>> server I'm going to have. I have a VM with web2py and nginx/uwsgi >>>>>>> installed on Debian. The database is Postgres which runs on the host >>>>>>> of >>>>>>> the VM and talks thru a "host only" network adapter, also on Linux. >>>>>>> >>>>>>> It all seems to work -- web2py can see and use the Postgres >>>>>>> database, I can serve pages thru nginx and uwsgi. But when I start the >>>>>>> scheduler all hell breaks loose. >>>>>>> >>>>>>> >>>>>>> web2py Web Framework >>>>>>> Created by Massimo Di Pierro, Copyright 2007-2013 >>>>>>> Version 2.5.1-stable+timestamp.2013.06.06.15.39.19 >>>>>>> Database drivers available: SQLite(sqlite3), MySQL(pymysql), >>>>>>> PostgreSQL(pg8000), IMAP(imaplib) >>>>>>> starting single-scheduler for "swim_smarter"... >>>>>>> ERROR:web2py.scheduler.groomlake2#3208: error popping tasks >>>>>>> ERROR:web2py.scheduler.groomlake2#3208:Error retrieving status >>>>>>> ERROR:web2py.scheduler.groomlake2#3208: error popping tasks >>>>>>> ERROR:web2py.scheduler.groomlake2#3208: error popping tasks >>>>>>> ERROR:web2py.scheduler.groomlake2#3208: error popping tasks >>>>>>> ERROR:web2py.scheduler.groomlake2#3208: error popping tasks >>>>>>> ERROR:web2py.scheduler.groomlake2#3208: error popping tasks >>>>>>> ERROR:web2py.scheduler.groomlake2#3208:Error retrieving status >>>>>>> ERROR:web2py.scheduler.groomlake2#3208: error popping tasks >>>>>>> ERROR:web2py.scheduler.groomlake2#3208: error popping tasks >>>>>>> ERROR:web2py.scheduler.groomlake2#3208: error popping tasks >>>>>>> ERROR:web2py.scheduler.groomlake2#3208: error popping tasks >>>>>>> >>>>>>> >>>>>>> Maybe I'm starting the scheduler wrong. I'm using sudo to start an >>>>>>> instance of web2py separate from uwsgi, but using www-data:www-data as >>>>>>> the >>>>>>> user and group. I only pass "-K" and the application name, once here >>>>>>> but >>>>>>> I'd like to start 3 to 6 instances. The console begins immediately >>>>>>> pouring >>>>>>> out error messages from the schedulers, but I can see from the databse >>>>>>> tables on the host that no processes have been inserted as workers into >>>>>>> the >>>>>>> table yet. >>>>>>> >>>>>>> What is the best way of using scheduler processes with nginx/uwsgi? >>>>>>> Can it be started and stopped with the server? I really depend on this >>>>>>> scheduler -- it's one of the best features of web2py -- so if I have to >>>>>>> use >>>>>>> apache or something else in production I'll do that. >>>>>>> >>>>>>> -- Joe >>>>>>> >>>>>> -- --- 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

