Skip to content

(feature) Refer to a function defined in another module #5

@ygravrand

Description

@ygravrand

When testing Multyvac during Pycon workshops, we ran into a problem when a function is defined in another module:

From the main example in cloudpipe, move 'add' function into a 'test' module and then:

from test import add
print 'Locally:', add(2,3)

job_id = multyvac.submit(add, 2, 3)
job = multyvac.get(job_id)
print 'Remotely:', job.get_result()

Results:

Locally: 2 + 3 = 5
5
Remotely:
Traceback (most recent call last):
  File "simpletest2.py", line 13, in <module>
    print 'Remotely:', job.get_result()
  File "$$edited$$/multyvac-fork/multyvac/job.py", line 105, in get_result
    raise e
multyvac.job.JobError: Traceback (most recent call last):
  File "/home/rho/anaconda/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/home/rho/anaconda/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/rho/anaconda/lib/python2.7/site-packages/multyvacinit/pybootstrap.py", line 10, in <module>
    (f, args, kwargs) = pickle.load(sys.stdin)
  File "/home/rho/anaconda/lib/python2.7/pickle.py", line 1378, in load
    return Unpickler(file).load()
  File "/home/rho/anaconda/lib/python2.7/pickle.py", line 858, in load
    dispatch[key](self)
  File "/home/rho/anaconda/lib/python2.7/pickle.py", line 1090, in load_global
    klass = self.find_class(module, name)
  File "/home/rho/anaconda/lib/python2.7/pickle.py", line 1124, in find_class
    __import__(module)
ImportError: No module named test

Need to investigate in cloudpickle.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions