thasso / pyjip

JIP Pipeline System
http://pyjip.readthedocs.org
Other
19 stars 8 forks source link

TypeError: can't pickle instancemethod objects when including init/validate/setup methods #61

Open necrolyte2 opened 8 years ago

necrolyte2 commented 8 years ago

When building python classes and wrapping them with @pytool it throws an exception if you have init, setup or validate methods

 for t in validate init setup; do JIP_MODULES=hello_world.py jip run cls_hello_world_${t}_py; done
Traceback (most recent call last):
  File "/media/VD_Research/People/tyghe.vallard/Projects/bioframework/myconda/bin/jip", line 9, in <module>
    load_entry_point('pyjip', 'console_scripts', 'jip')()
  File "/media/VD_Research/People/tyghe.vallard/Projects/bioframework/myconda/lib/python2.7/site-packages/jip/cli/jip_main.py", line 81, in main
    _main()
  File "/media/VD_Research/People/tyghe.vallard/Projects/bioframework/myconda/lib/python2.7/site-packages/jip/cli/jip_main.py", line 131, in _main
    runpy.run_module("jip.cli.jip_%s" % cmd, run_name="__main__")
  File "/media/VD_Research/People/tyghe.vallard/Projects/bioframework/myconda/lib/python2.7/runpy.py", line 180, in run_module
    fname, loader, pkg_name)
  File "/media/VD_Research/People/tyghe.vallard/Projects/bioframework/myconda/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/media/VD_Research/People/tyghe.vallard/Projects/bioframework/myconda/lib/python2.7/site-packages/jip/cli/jip_run.py", line 107, in <module>
    main()
  File "/media/VD_Research/People/tyghe.vallard/Projects/bioframework/myconda/lib/python2.7/site-packages/jip/cli/jip_run.py", line 67, in main
    profile=profile)
  File "/media/VD_Research/People/tyghe.vallard/Projects/bioframework/myconda/lib/python2.7/site-packages/jip/jobs.py", line 1096, in create_jobs
    job = from_node(node, keep=keep)
  File "/media/VD_Research/People/tyghe.vallard/Projects/bioframework/myconda/lib/python2.7/site-packages/jip/jobs.py", line 971, in from_node
    cmds = node._tool.get_command()
  File "/media/VD_Research/People/tyghe.vallard/Projects/bioframework/myconda/lib/python2.7/site-packages/jip/tools.py", line 1609, in get_command
    return self.decorator.get_command(self, self.instance)
  File "/media/VD_Research/People/tyghe.vallard/Projects/bioframework/myconda/lib/python2.7/site-packages/jip/tools.py", line 358, in get_command
    (cPickle.dumps(data).encode("base64")))
  File "/media/VD_Research/People/tyghe.vallard/Projects/bioframework/myconda/lib/python2.7/copy_reg.py", line 70, in _reduce_ex
    raise TypeError, "can't pickle %s objects" % base.__name__
TypeError: can't pickle instancemethod objects