nssm & scheduler seems to be a nobrainer...

336 views
Skip to first unread message

Marian

unread,
Apr 5, 2013, 2:12:57 AM4/5/13
to web...@googlegroups.com
...but I cannot get it to work. As soon as I start the service via the service console, it terminates without an error code. It tried 32/64 bit version of nssm, w and w/o quotes for the paths. In procexp I see that the python.exe is started but it terminates immediately.

pythonw.exe without AppParameters crashes, python.exe works, but as soon as I try an AppParameter like -K APPNAME, it crashes.
I tried python2.7.3 with win32 and also ActiveState Python 2.7.3

Maybe somebody is kind and posts some screenshots of the registry settings of a working nssm scheduler service. :)

Marian

unread,
Apr 5, 2013, 5:34:30 AM4/5/13
to web...@googlegroups.com
I dug around in the event log and found:

Started C:\Python27\pythonw.exe D:\web2py\web2py.py -K imagecontest for service web2py_scheduler_imagecontest4 in C:\Python27\.

Program C:\Python27\pythonw.exe for service web2py_scheduler_imagecontest4 exited with return code 1.

Killing process tree of process 7296 for service web2py_scheduler_imagecontest4 with exit code 1

The scheduler works when used directly with python.

Niphlod

unread,
Apr 5, 2013, 6:46:36 AM4/5/13
to web...@googlegroups.com
As soon as I get home I'll make screenshot of the configs .... I hadn't any problems a few months back, but I'll recheck for sure and post here or on web2pyslices.com the steps involved.

Marian

unread,
Apr 5, 2013, 7:36:37 AM4/5/13
to web...@googlegroups.com
That would be awesome. Thanks for the great work! :)

Marian

unread,
Apr 5, 2013, 8:35:15 AM4/5/13
to web...@googlegroups.com
Hm maybe I have a hint, I found a failed entry in db.scheduler_run:

gluon.shell line 137: sys.exit(1).

When I try to restart the service, I don't get new failed tasks, so I cannot say where this specific one came from.

Niphlod

unread,
Apr 5, 2013, 3:56:32 PM4/5/13
to web...@googlegroups.com

Brian M

unread,
Apr 6, 2013, 3:37:56 PM4/6/13
to web...@googlegroups.com
Did you get it working? If not I can check how I did it on my server later today

Marian

unread,
Apr 8, 2013, 3:28:30 AM4/8/13
to web...@googlegroups.com
Thank you Niphlod for the slice. :)

But sadly it's not working for me. The problem is somehow my application and not nssm. If I define a scheduler in the welcome app it works.
In my app even a blank scheduler function fails.
In scheduler.py I found a check on WEB2PY_PATH, so I set it but without effect
I tried to remove all dependencies from custom modules without effect.

I think it fails in gluon.shell. What could cause this issue? I am not trying to do anny fancy stuff. ;)

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

Niphlod

unread,
Apr 8, 2013, 3:41:38 AM4/8/13
to web...@googlegroups.com
If a scheduler in the welcome app works, I'm quite sure (90%, give or take) that the problem lies in your app code....

the point is: your scheduler doesn't work as a service cause as soon as it's started it dies or because while running all task fail ?

Marian

unread,
Apr 8, 2013, 4:12:48 AM4/8/13
to web...@googlegroups.com
I think you are right, it has something to do with the application itself. It dies directly on startup with exit code 1. The scheduler works when it is started in command line, so I think there is a problem with the environment or something like that.

Niphlod

unread,
Apr 8, 2013, 4:25:34 AM4/8/13
to web...@googlegroups.com
are you "playing" with signals by any chance ?

Marian

unread,
Apr 8, 2013, 4:36:40 AM4/8/13
to web...@googlegroups.com
I don't use signals, but I found the problem...

I linked my application via hardlink into the web2py applications folder so I can work with aptana studio and don't have to mess around with deploying everytime I change something.
I guess I need another way to separate web2py and the applications. Maybe you have a best practise for this?

Sorry for the troubles ;)

Marian

unread,
Apr 8, 2013, 5:21:54 AM4/8/13
to web...@googlegroups.com
Hardlinking the whole applications folder into web2py seems to work...
Reply all
Reply to author
Forward
0 new messages