SystemExit: 1 ticket on scheduler

84 views
Skip to first unread message

Gael Princivalle

unread,
Jan 30, 2017, 8:02:29 AM1/30/17
to web2py-users
Hello.

I've got a scheduler function that run each 30 seconds for sending web push notifications:

def process_webn_alerts():
    webn_alerts
= db(db.alerts.instant_webn_status == 1).select()
   
for webn_alert in webn_alerts:
        onesignal_players
= db(db.onesignal_players.created_by == webn_alert.to_user).select()
       
for onesignal_player in onesignal_players:
            header
= {"Content-Type": "application/json; charset=utf-8",
               
"Authorization": "Basic my_auth_key"}
            payload
= {"app_id": "my_app_id",
               
"headings": {"en": webn_alert.title},
               
"include_player_ids": [onesignal_player.uuid],
               
"contents": {"en": webn_alert.body},
               
"url": webn_alert.link,
               
"chrome_web_icon": webn_alert.icon_url
               
}
            req
= requests.post("https://onesignal.com/api/v1/notifications", headers=header, data=json.dumps(payload))
           
print(req.status_code, req.reason)
            db
(db.alerts.id == webn_alert.id).update(instant_webn_status = 2)
    db
.commit()

It has run correctly for 10 hours, without any web push notification to send. After that it failed with this ticket:

Traceback (most recent call last):
 
File "/home/tasko/webapps/w2p_2_14_16/web2py/gluon/scheduler.py", line 293, in executor
    _env
= env(a=a, c=c, import_models=True)
 
File "/home/tasko/webapps/w2p_2_14_16/web2py/gluon/shell.py", line 166, in env
    sys
.exit(1)
SystemExit: 1

Does it mean that the http Onesignal call has failed?

Thanks.

Anthony

unread,
Jan 30, 2017, 4:16:49 PM1/30/17
to web2py-users
Looks like maybe an error somewhere in your model files. Is that the traceback from the associated record in the scheduler_run table?

Anthony

Niphlod

unread,
Jan 31, 2017, 2:45:49 AM1/31/17
to web2py-users
or it got a SIGTERM, or it was timing out. 

Gael Princivalle

unread,
Jan 31, 2017, 4:03:08 AM1/31/17
to web...@googlegroups.com
>Is that the traceback from the associated record in the scheduler_run table?
Yes

----------------------
Gael Princivalle

--
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/EOIJFWpBafM/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.

Gael Princivalle

unread,
Jan 31, 2017, 4:08:18 AM1/31/17
to web...@googlegroups.com
Ok probably a timing out due to the https call that has not replied in less than 60 sec (the timeout of the task).
I've set now retry_failed to -1.

Thanks.

----------------------
Gael Princivalle

Gael Princivalle

unread,
Mar 2, 2017, 3:16:04 PM3/2/17
to web2py-users
Hello.

I'm still have hundred of similar errors on different scheduler functions. If they are due to an error in the models how can I have a complete traceback of this error for understanding where is it exactly, and which one is it?
.
In shell.py the code is:

    if import_models:
       
try:
            run_models_in
(environment)
       
except RestrictedError, e:
            sys
.stderr.write(e.traceback + '\n')
            sys
.exit(1)

A traceback from scheduler_run:
Traceback (most recent call last):
 
File "/home/tasko/webapps/w2p_2_14_16/web2py/gluon/scheduler.py", line 293, in executor
    _env
= env(a=a, c=c, import_models=True)
 
File "/home/tasko/webapps/w2p_2_14_16/web2py/gluon/shell.py", line 166, in env
    sys
.exit(1)
SystemExit: 1

A scheduler function don't generate always this error, that's strange.

Someone can give me a hand?

Thanks.

Gael Princivalle

unread,
Mar 3, 2017, 9:54:00 AM3/3/17
to web2py-users
This sys.exit(1) error was for all the workers of all my applications in the same web2py installation. I've set know for all scheduler tasks the 'Prevent drift' option and it seems to works.
Reply all
Reply to author
Forward
0 new messages