gpilab / framework

The GPI framework provides the canvas for graphically assembling algorithms.
Other
20 stars 7 forks source link

Reloading C++ modules each time a node executes #51

Open borupdaniel opened 4 years ago

borupdaniel commented 4 years ago

Per Jim, in previous versions of GPI PyMOD extensions would be re-loaded each time a node ran. This meant you could run gpi_make in the background and immediately use the new changes. The current behavior is not the same — now you have to re-launch GPI to use the newly compiled extension. I'm not sure if this is always consistent as I thought sometimes refreshing or re-placing the node would work, as did using the "imp.reload()" function in the node.

Ideal behavior: PyMOD extensions are re-loaded each time a node executes OR when a node is refreshed/replaced.

borupdaniel commented 4 years ago

@aganders3 can you add any info on how this worked previously?

aganders3 commented 4 years ago

I don't think this was ever the case. I looked into this recently actually and it's pretty hard (unsafe) to reload c-extensions in Python without restarting the interpreter. If you find a way to do this cleanly please let me know!

I think Python changes still required a node reload (⌘-R) to take effect, but you could probably make this happen each run fairly easily.

With the second piece of information you might be able to hack something that would detect recompiled C/C++ code and re-import it, but it would be a hack (like renaming the file or something).

aganders3 commented 4 years ago

This covers some workarounds. Maybe with the node execution mode set to process it will work?

https://stackoverflow.com/a/8295590/333308