Closed kaanaksit closed 4 years ago
One possibility (easier approach?) is to put functions in a module (separate file), send it with depends
and have compute
function import that module and use functions in that module.
Thank you. That resolved my case. I followed your suggestion and
compute
, I also import that module and use it.Great! Note that there is no need to import new module in client program (where cluster is generated), unless functions in new module are used in processing results etc.
I am a happy user of
dispy
. First of all, thank you for making it happen!Context
Assume there are three files that represents my python program:
main.py
, where I gather some shell arguments and load some json dictionary and start the entire program,routine.py
, where I pass some variables frommain.py
and start my compute method/definition/function,simulation.py
, where the compute method/definition/function is.Inside
routine.py
, I importcompute
fromsimulation.py
and start a cluster accordingly.Sturggle
I need some more methods/definitions/functions from
simulation.py
duringcompute
, and my solution was to embed these other things into thecompute
as in below example:I find my solution to be very ugly.If I leave the other_functions outside of compute, I always get this can not find module error even if I try importing
simulate.py
insidecompute
.Is there a better way to do this? Your help and suggestion is very much appreciated!