Is there a way to keep the package names for python modules that are transmitted via dispy's depends feature? That would allow using packages/modules in the same way when called with and without a dispy context.
Simple Example:
Module mypackage.dispytestDepends:
def myFun():
return "Foo"
main module as I'd like it to have (doesn't work):
def dependsFunTask(): #works only when called without dispy
import mypackage.dispytestDepends
ret = mypackage.dispytestDepends.myFun()
return ret
import dispy
if __name__ == '__main__':
cluster = dispy.JobCluster(dependsFunTask,depends = mypackage.dispytestDepends) # doesn't work
job = cluster.submit()
output = job()
print output ### output is None
mypackage.dependsFunTask() # works
Working, yet ugly version, since I have lots of code that would have to be rewritten:
def dependsFunTask(): #only works when called through dispy
import dispytestDepends
ret = dispytestDepends.myFun()
return ret
import dispy
if __name__ == '__main__':
cluster = dispy.JobCluster(dependsFunTask,depends = mypackage.dispytestDepends) # works
job = cluster.submit()
output = job()
print output ### output is "Foo"
dependsFunTask() # doesn't work