Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BaseModule.work() signature not compatible with Worker #1496

Open
gst opened this issue Feb 5, 2015 · 6 comments
Open

BaseModule.work() signature not compatible with Worker #1496

gst opened this issue Feb 5, 2015 · 6 comments

Comments

@gst
Copy link
Contributor

gst commented Feb 5, 2015

in Satellite.create_and_launch_worker() we have:

                    **target = module.work**   # module is a BaseModule instance
...
w = Worker(..., **target=target**, ...)

in Worker.init (1) we have :

        self._process = Process(target=target, **args=(s, returns_queue, self._c)**)

but in BaseModule class we have :

    def _main(self):   ** does not declare the 3 args as given to the Process in (1) **
        """module "main" method. Only used by external modules."""
        ...
    work = _main

so, actually (don't know since when, always?), any (external) module can't use the default work() method of BaseModule (== has to redefine it with a proper function signature), which is a pity because BaseModule.work() has the advantage of setting up different things, like the signal handler and also set the proc title.

@titilambert
Copy link
Contributor

WOOOOOOH !!!!!
How all of this can work ?? This is a mystery !
We need Scooby Dooby

Good job man !

@gst
Copy link
Contributor Author

gst commented Feb 5, 2015

How all of this can work ??

I guess all current (external only normally) modules are defining their own 'work' method (with the good arguments signature).. or something ;)

@gst
Copy link
Contributor Author

gst commented Feb 5, 2015

anyway, from what I see / understand (I may miss some things still) :

Worker and BaseModule seem to define/duplicate certain things that could be again factorized etc.. but again it requires some non-trivial work to clarify all that.

@Seb-Solon
Copy link
Contributor

Looks like the create_and_launch_worker method is only used by satellites (poller / reactionner) because all other daemon extend the main method of Sattellite. So the issue is only with to kind of worker module (named pipe work for poller but is not worker capable)

So basically all poller module we have implements their own work method. I guess you did not do it in the new poller module you are doing so you faced this issue :)

@gst
Copy link
Contributor Author

gst commented Feb 5, 2015

I guess you did not do it in the new poller module you are doing so you faced this issue :)

that's exactly it ;)

@gst
Copy link
Contributor Author

gst commented Feb 6, 2015

will be corrected by #1500

@Seb-Solon Seb-Solon modified the milestone: 2.6 () Mar 9, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants