If you want, pack your app or a example with same behavior using the admin
interface as a w2p file and send it to the list.

No promises...

Nico


Op di 22 nov. 2016 om 12:47 schreef Vid Ogris <vid.og...@gmail.com>

There is no errors, the file is read etc. The task's status is always
TIMEOUT, although the first time I call it is executed correctly.

Then I delete the values of the fields the task manipulates with and the
second time around values are not inserted and also there is no error or
anything in the tables.

any suggestiions?


2016-11-21 15:00 GMT+08:00 Nico de Groot <ndegro...@gmail.com>:

Hi Vid,

Two remarks at first sight.

In save_outs you initialize the variable now. But you queue the task using
start_now. But the task is inserted, maybe just copy paste error in your
post...

Is the function readOutFile working? Can you show It? It seems it gets
stuck when called the second time. I would suggest to step through the code
using the debugger, or use print statement to pinpoint the timeout.

Nico

Op za 19 nov. 2016 om 05:41 schreef Vid Ogris <vid.og...@gmail.com>

SO the problem continues.

The task was running  and was completed for some dummy code.

Now i have to go trough a folder, read a file and update file content to
database.

The task always times out and there are two files that need to be updated,
non of them are. The code is executed, but there is no db update. Also it
seems for loop is not completed. For only one file db._lastsql is printed
in db. The statement in scheduler table is ok and if i run it it inserts
data into db. Any suggestions?

My code

in scheduler.py

def saveIdOut():
    try:
        #demo koda
        #poberem statuse
        db_status = db(db.scripts.sc_status ==
11).select(db.scripts.id).as_list()
        #ggrem v mapo in pogledam katere skripte ki imajo status 11 se
dejansko izvajajo
        for rec in db_status:
            scriptId = rec["id"]
            outPath  = os.path.join(request.folder, 'engine', 'e1',
str(scriptId) + '.out')
            #preverim če obstaja datoteka
            if os.path.isfile(outPath):
                #če obstaja jo shranim v sc_engine_output
                #sparsamo out datoteko da jo lahko damo v tabelo result
                out = readOutFile(str(scriptId))
                #Vnesemo podatke v tabelo script
                db(db.scripts.id == scriptId).update(sc_engine_output = out)
                print db._lastsql

                print "out datoteka za scripto %s, arhivirana" % (str(scriptId))

        db.commit()
        return dict(status = 1)

    except Exception, e:
        exc_type, exc_obj, exc_tb = sys.exc_info()
        fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
        print(exc_type, fname, exc_tb.tb_lineno)
        print e.__doc__
        print e.message
        return dict(status = 666)


in my controler

def save_outs():


    """
    for running scheduler
    python web2py.py --nogui --no-banner -K woshiweb -D 0

    1 hour = 3600 seconds # for period
    10 minutes = 600 seconds # for timeout
    """

    import datetime
    now = datetime.datetime.now()


    start_now = datetime.datetime.now()

    stop_time_now = (start_now + datetime.timedelta(days = 1))

    scheduler.queue_task(saveIdOut, start_time = start_now,


                   next_run_time = start_now, stop_time = stop_time_now,

                   repeats = 0, retry_failed = 2, period = 30, timeout = 15)

    print "Funkcija za arhiviranje outov AKTIVIRANA...."
    print "Glej scheduler tabele v postgresu"
    session.flash = T("Task save_outs Queued")
    redirect(URL('index.html'))


2016-11-16 2:32 GMT+08:00 Dave S <snidely....@gmail.com>:



On Tuesday, November 15, 2016 at 2:14:21 AM UTC-8, Yebach wrote:

Thank you guys. I finally made it. I did not quite understand the whole
scheduler process but i am now getting there.

Thank you again


Congratulations!  It sometimes takes a while to get the right mental
images, doesn't it?

/dps

-- 
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/FK1ygjNNjDU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.




-- 
Lep pozdrav

Vid Ogris


-- 
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/FK1ygjNNjDU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
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/FK1ygjNNjDU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.




-- 
Lep pozdrav

Vid Ogris


-- 
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/FK1ygjNNjDU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to
web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

-- 
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/d/optout.

Reply via email to