Re: Error "signal only works in main thread"
stm <[email protected]>
| Newsgroups | gmane.comp.python.cherrypy |
|---|---|
| Message-ID | <[email protected]> |
Hi Joel,
thanks for your answer! I implemented a plugin for the optimization
routines, but it still results in the same error. :/ Are you sure plugins
run on the main thread?
Please take a look at the code - did I do anything wrong?
https://gist.github.com/anonymous/d955db89c8381d052653
And the error is:
Traceback (most recent call last):
File "C:\...\pyenv\lib\site-packages\cherrypy\_cprequest.py", line 670,
in respond
response.body = self.handler()
File "C:\...\pyenv\lib\site-packages\cherrypy\lib\encoding.py", line 217,
in __call__
self.body = self.oldhandler(*args, **kwargs)
File "C:\...\pyenv\lib\site-packages\cherrypy\_cpdispatch.py", line 61,
in __call__
return self.callable(*self.args, **self.kwargs)
File "server.py", line 10, in index
return cherrypy.engine.publish("optimize", {"Amax": 42}).pop()
File "C:\...\pyenv\lib\site-packages\cherrypy\process\wspbus.py", line
223, in publish
raise exc
cherrypy.process.wspbus.ChannelFailures: ValueError('*signal only works in
main thread*',)
Max
Am Freitag, 11. März 2016 19:23:04 UTC+1 schrieb Joel Rivera:
>
> Create a plugin and publish channels to call the pyomo methods from
> the main thread, more specifically methods that uses the calls to
> pyomo. If the problem is limited to `SolverFactory("glpk").solve(m)`
> then you can just publish a channel to do:
>
> result = cherrypy.engine.publish('solve', 'glpk', m).pop()
>
> The plugins execute at the `cherrypy.engine` level which is the
> Main-Thread.
>
> For more information about the plugins/server-wide functions:
>
> http://docs.cherrypy.org/en/latest/extend.html#server-wide-functions
>
> Regards
>
> On Fri, 11 Mar 2016 04:49:29 -0800 (PST)
> stm <[email protected] <javascript:>> wrote:
>
> > Hi,
> >
> > I'd like to create a simple web API using Cherrypy that can be used
> > to solve some optimization problem using Pyomo (pyomo.org).
> >
> > When Pyomo's solve method is called I get the error "signal only
> > works in main thread".
> >
> > What can I do to make this work? Is it possible to make Cherrypy run
> > on the main thread? (I know it'd be slower, but don't mind)
> >
> > Here's a minimal example to reproduce the problem:
> >
> > https://gist.github.com/anonymous/ea94c3c45bbcb71a6850
> > Thanks!
> >
>
> --
> Rivera²
>
--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cherrypy-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To post to this group, send email to cherrypy-users-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.