scheduler question

44 views
Skip to first unread message

Andrea Fae'

unread,
Feb 6, 2018, 10:58:15 AM2/6/18
to web2py-users
Hello, days ago I started to use scheduler and all was working very well. I could see db.scheduler_run.task_id lines in the db with all the results and console.

Now the scheduler works very well but I don't see nothing in the table db.scheduler_run.task_id. Why? Talk completed without problems...

This is my routine (from the moment I tried to use AppConfig - now is commented - I noted no lines in the table above...)

def chiusura_automatica_ticket():
    esito = False
    # questa è la data odierna
    todate = datetime.date.today()
    # print 'todate = ', todate
    
    # carico da appconfig.ini il numero di giorni lavorativi in cui lo scehdulature chiude in automatico le richieste di intervento
    # mycustom_conf = AppConfig()
    # questo è il delta in giorni lavorativi indietro
    # giorni_da_apertura = mycustom_conf.get('custom.automatic_ticket_closing')
    giorni_da_apertura = 30
    print giorni_da_apertura
    
    # questa è la data di partenza
    fromdate = date_by_subtract_business_days(todate,giorni_da_apertura)
    # print 'fromdate = ',fromdate

    # seleziono i ticket prima della data "fromdate" che non siano ancora chiusi
    query = (db.ticket.created_on < fromdate) & (db.ticket.chiuso == False)
    db(query).update(chiuso = True, risoluzione = 'CHIUSO AUTOMATICAMENTE')
    # commit necessaria
    esito = db.commit()
    return esito

Dave S

unread,
Feb 6, 2018, 3:05:19 PM2/6/18
to web2py-users


On Tuesday, February 6, 2018 at 7:58:15 AM UTC-8, Andrea Fae' wrote:
Hello, days ago I started to use scheduler and all was working very well. I could see db.scheduler_run.task_id lines in the db with all the results and console.

Now the scheduler works very well but I don't see nothing in the table db.scheduler_run.task_id. Why? Talk completed without problems...

I don't know.  My scheduler_run rows all show a task_id.  I have more than 2500 runs since switching to 2.15.4 (minimum of 3 runs a day).  I had 1900+ runs under 2.14.6.


This is my routine (from the moment I tried to use AppConfig - now is commented - I noted no lines in the table above...)


Where does this code live?  In a model file, a module, or ??

How do you schedule it?

 
def chiusura_automatica_ticket():
    esito = False
    # questa è la data odierna
    todate = datetime.date.today()
    # print 'todate = ', todate
    
    # carico da appconfig.ini il numero di giorni lavorativi in cui lo scehdulature chiude in automatico le richieste di intervento
    # mycustom_conf = AppConfig()
    # questo è il delta in giorni lavorativi indietro
    # giorni_da_apertura = mycustom_conf.get('custom.automatic_ticket_closing')
    giorni_da_apertura = 30
    print giorni_da_apertura
    
    # questa è la data di partenza
    fromdate = date_by_subtract_business_days(todate,giorni_da_apertura)
    # print 'fromdate = ',fromdate

    # seleziono i ticket prima della data "fromdate" che non siano ancora chiusi
    query = (db.ticket.created_on < fromdate) & (db.ticket.chiuso == False)
    db(query).update(chiuso = True, risoluzione = 'CHIUSO AUTOMATICAMENTE')
    # commit necessaria
    esito = db.commit()
    return esito


/dps
 

andfae

unread,
Feb 6, 2018, 3:10:18 PM2/6/18
to web...@googlegroups.com
I created like in the book. It's a model. I'm scheduling from the database administrative interface. 2 days ago worked perfectly! I don't know!

--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/Xjtf3rRBZyU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dave S

unread,
Feb 7, 2018, 2:40:07 AM2/7/18
to web2py-users
On Tuesday, February 6, 2018 at 12:10:18 PM UTC-8, Andrea Fae' wrote:
I created like in the book. It's a model. I'm scheduling from the database administrative interface. 2 days ago worked perfectly! I don't know!


I've never tried that.  The production system I run the scheduler on doesn't have a GUI to run a browser from, and I don't often set up SSL port forwarding to run appadmin from my client system.  I schedule either through a web page (exposed controller function) or through using -S on the command line (non-exposed controller function.

See

(The online copy of the book hasn't been synched with github for a while, it seems, so I can't point you at a pretty copy.)

/dps

 
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages