[web2py] Re: Can't make db calls with scheduler

2012-05-14 Thread Niphlod
definitely the way to go, I faced the issue before myself, sorry not to 
have reported that ;-)
I don't think it's a issue per se, scheduler is quite nice to manage at 
"low level".

Il giorno lunedì 14 maggio 2012 04:46:11 UTC+2, Yarin ha scritto:
>
> Sorry, figured this out- db calls made with the scheduler need a 
> db.commit()
>
> On Sunday, May 13, 2012 10:20:51 PM UTC-4, Yarin wrote:
>>
>> I'm using the scheduler and everything is working nicely, except that any 
>> calls I make to the db in the task function are ignored- Even though the 
>> tasks complete successfully, there's no error, or any indication from the 
>> worker that something went wrong. This is happening for both MySQL and 
>> SQLite. 
>>
>> Below is my complete schedule.py file:
>> from gluon.scheduler import Scheduler
>>
>>
>> def update_it():
>>  row_id = db.test.insert(name='bob') # Nothing will be inserted, and no 
>> error will be raised
>>  return row_id
>>
>>
>> myscheduler = Scheduler(db, dict(update_it=update_it))
>>
>> The book doesn't say anything about not being able to use the db. 
>>
>>
Il giorno lunedì 14 maggio 2012 04:46:11 UTC+2, Yarin ha scritto:
>
> Sorry, figured this out- db calls made with the scheduler need a 
> db.commit()
>
> On Sunday, May 13, 2012 10:20:51 PM UTC-4, Yarin wrote:
>>
>> I'm using the scheduler and everything is working nicely, except that any 
>> calls I make to the db in the task function are ignored- Even though the 
>> tasks complete successfully, there's no error, or any indication from the 
>> worker that something went wrong. This is happening for both MySQL and 
>> SQLite. 
>>
>> Below is my complete schedule.py file:
>> from gluon.scheduler import Scheduler
>>
>>
>> def update_it():
>>  row_id = db.test.insert(name='bob') # Nothing will be inserted, and no 
>> error will be raised
>>  return row_id
>>
>>
>> myscheduler = Scheduler(db, dict(update_it=update_it))
>>
>> The book doesn't say anything about not being able to use the db. 
>>
>>
Il giorno lunedì 14 maggio 2012 04:46:11 UTC+2, Yarin ha scritto:
>
> Sorry, figured this out- db calls made with the scheduler need a 
> db.commit()
>
> On Sunday, May 13, 2012 10:20:51 PM UTC-4, Yarin wrote:
>>
>> I'm using the scheduler and everything is working nicely, except that any 
>> calls I make to the db in the task function are ignored- Even though the 
>> tasks complete successfully, there's no error, or any indication from the 
>> worker that something went wrong. This is happening for both MySQL and 
>> SQLite. 
>>
>> Below is my complete schedule.py file:
>> from gluon.scheduler import Scheduler
>>
>>
>> def update_it():
>>  row_id = db.test.insert(name='bob') # Nothing will be inserted, and no 
>> error will be raised
>>  return row_id
>>
>>
>> myscheduler = Scheduler(db, dict(update_it=update_it))
>>
>> The book doesn't say anything about not being able to use the db. 
>>
>>
Il giorno lunedì 14 maggio 2012 04:46:11 UTC+2, Yarin ha scritto:
>
> Sorry, figured this out- db calls made with the scheduler need a 
> db.commit()
>
> On Sunday, May 13, 2012 10:20:51 PM UTC-4, Yarin wrote:
>>
>> I'm using the scheduler and everything is working nicely, except that any 
>> calls I make to the db in the task function are ignored- Even though the 
>> tasks complete successfully, there's no error, or any indication from the 
>> worker that something went wrong. This is happening for both MySQL and 
>> SQLite. 
>>
>> Below is my complete schedule.py file:
>> from gluon.scheduler import Scheduler
>>
>>
>> def update_it():
>>  row_id = db.test.insert(name='bob') # Nothing will be inserted, and no 
>> error will be raised
>>  return row_id
>>
>>
>> myscheduler = Scheduler(db, dict(update_it=update_it))
>>
>> The book doesn't say anything about not being able to use the db. 
>>
>>

[web2py] Re: Can't make db calls with scheduler

2012-05-13 Thread Yarin
Sorry, figured this out- db calls made with the scheduler need a db.commit()

On Sunday, May 13, 2012 10:20:51 PM UTC-4, Yarin wrote:
>
> I'm using the scheduler and everything is working nicely, except that any 
> calls I make to the db in the task function are ignored- Even though the 
> tasks complete successfully, there's no error, or any indication from the 
> worker that something went wrong. This is happening for both MySQL and 
> SQLite. 
>
> Below is my complete schedule.py file:
> from gluon.scheduler import Scheduler
>
>
> def update_it():
>  row_id = db.test.insert(name='bob') # Nothing will be inserted, and no 
> error will be raised
>  return row_id
>
>
> myscheduler = Scheduler(db, dict(update_it=update_it))
>
> The book doesn't say anything about not being able to use the db. 
>
>

[web2py] Re: Can't make db calls with scheduler

2012-05-13 Thread Massimo Di Pierro
I think you need to db.commit() in the task. Does that solve it?

On Sunday, 13 May 2012 21:20:51 UTC-5, Yarin wrote:
>
> I'm using the scheduler and everything is working nicely, except that any 
> calls I make to the db in the task function are ignored- Even though the 
> tasks complete successfully, there's no error, or any indication from the 
> worker that something went wrong. This is happening for both MySQL and 
> SQLite. 
>
> Below is my complete schedule.py file:
> from gluon.scheduler import Scheduler
>
>
> def update_it():
>  row_id = db.test.insert(name='bob') # Nothing will be inserted, and no 
> error will be raised
>  return row_id
>
>
> myscheduler = Scheduler(db, dict(update_it=update_it))
>
> The book doesn't say anything about not being able to use the db. 
>
>