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

Signal implementation for modules #201

Open
ghost opened this issue Aug 2, 2019 · 2 comments
Open

Signal implementation for modules #201

ghost opened this issue Aug 2, 2019 · 2 comments
Labels
enhancement New feature or request

Comments

@ghost
Copy link

ghost commented Aug 2, 2019

Some modules like DataPlot simply listen for requests and serve them in a loop with no exit condition like in:

while True:
d = self.recv(port)
if self.debug and i % self.print_freq == 0:
self.log.info('DataPlot::'+port.name+' received: {}'.format(d))
if isinstance(d, str) and d == "DONE":
self.data[port.name] = data
sys.exit(0) # kill thread
i += 1

Such modules should ideally die whenever the rest of the modules in the network die. To implement this behavior, Cortix needs a way to cleanly terminate a module from the master process (rank) upon request.

@dealmeidavf
Copy link
Member

dealmeidavf commented Aug 2, 2019

This module is a bit of a special case since it starts as many threads within one process (MPI or not) as there are ports connected to it...maybe some other internal behavior needs to be developed. The idea of having threads running within a process has a limit. Recall the run case with 1000 droplets. This module had 1000 threads open on a single MPI process.

@dealmeidavf
Copy link
Member

Signals sometimes can be part of model and they are implement with ports and part of the definition of a module. An example is in a facility modeling. Say module A models a process that breakdowns. If module A models the downstream process, a warning signal can be sent from A to B.

Following this idea, Cortix can initiate ports between modules in the background without the user knowledge. These ports can be used to track the progress of the modules by sending signals. This is a possible feature in the future.

@dealmeidavf dealmeidavf added the enhancement New feature or request label Aug 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant