Skip to content

Commit

Permalink
Merge pull request #966 from VisTrails/remove-serialize-interface
Browse files Browse the repository at this point in the history
Removes Serializable interface
  • Loading branch information
remram44 committed Jan 14, 2015
2 parents e2b31b4 + 4ae4fd1 commit bbfd698
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 45 deletions.
6 changes: 0 additions & 6 deletions vistrails/core/modules/basic_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,6 @@ def compute(self):
def setValue(self, v):
self.set_output("value", self.translate_to_python(v))
self.upToDate = True

def serialize(self):
return self.outputPorts['value_as_string']

def deserialize(self, v):
return self.translate_to_python(v)

@staticmethod
def translate_to_string(v):
Expand Down
24 changes: 1 addition & 23 deletions vistrails/core/modules/vistrails_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,32 +184,10 @@ def __getattr__(self, name):

_dummy_logging = DummyModuleLogging()

################################################################################
# Serializable

class Serializable(object):
"""
Serializable is a mixin class used to define methods to serialize and
deserialize modules.
"""

def serialize(self):
"""
Method used to serialize a module.
"""
raise NotImplementedError('The serialize method is not defined for this module.')

def deserialize(self):
"""
Method used to deserialize a module.
"""
raise NotImplementedError('The deserialize method is not defined for this module.')

################################################################################
# Module

class Module(Serializable):
class Module(object):
"""Module is the base module from which all module functionality
is derived from in VisTrails. It defines a set of basic interfaces to
deal with data input/output (through ports, as will be explained
Expand Down
19 changes: 3 additions & 16 deletions vistrails/packages/parallelflow/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ def execute_wf(wf, output_port):

# Get the output value
output = None
serializable = None
if not execution_errors:
executed_module, = execution[0][0].executed
executed_module = execution[0][0].objects[executed_module]
Expand All @@ -123,16 +122,12 @@ def execute_wf(wf, output_port):
except ModuleError:
errors.append("Output port not found: %s" % output_port)
return dict(errors=errors)
reg = vistrails.core.modules.module_registry.get_module_registry()
base_classes = inspect.getmro(type(output))
if Module in base_classes:
serializable = reg.get_descriptor(type(output)).sigstring
output = output.serialize()
if isinstance(output, Module):
raise TypeError("Output value is a Module instance")

# Return the dictionary, that will be sent back to the client
return dict(errors=errors,
output=output,
serializable=serializable,
xml_log=xml_log,
machine_log=machine_log)
finally:
Expand Down Expand Up @@ -392,15 +387,7 @@ def updateFunctionPort(self):
reg = vistrails.core.modules.module_registry.get_module_registry()
self.result = []
for map_execution in map_result:
serializable = map_execution['serializable']
output = None
if not serializable:
output = map_execution['output']
else:
d_tuple = vistrails.core.modules.utils.parse_descriptor_string(serializable)
d = reg.get_descriptor_by_name(*d_tuple)
module_klass = d.module
output = module_klass().deserialize(map_execution['output'])
output = map_execution['output']
self.result.append(output)

# including execution logs
Expand Down

0 comments on commit bbfd698

Please sign in to comment.