Object inputs for PyTask

Hi all,

I’m making good use of Fireworks as an Executor (much like the core python class) and it works perfectly when the args and kwargs are standard variable types (int, str, float, bool, …). I am running into errors with objects as inputs though.

For example, here’s a simple script where I use pymatgen.core.composition.Composition input –

# connect to my launchpad
launchpad = LaunchPad.from_file('my_launchpad.yaml')

# Here's a generic example of my inputs for PyTask
from pymatgen.core.composition import Composition
composition = Composition('SiO2')
func = 'myrepo.predict_volume' # a generic function that has composition object at the input
args = [composition]
kwargs = {}

# make my workflow
firetask = PyTask(func = func, args = args, kwargs = kwargs, stored_data_varname='result')
firework = Firework(firetask)
workflow = Workflow([firework])

# add workflow to launchpad
launchpad.add_wf(workflow)

#####
# wait for workflow to complete
#####

# grab the result
firework = launchpad.get_fw_by_id(firework.fw_id)
### this code below will fail because the workflow fizzles 
launch = firework.launches[-1]
result = launch.action.stored_data['result'] 

In this example, the composition object is serialized to json/dictionary for MongoDB, but when the PyTask actually executes, it is not reverted back to a Composition object. Thus, I get an error by calling something like composition.elements within the function – where the error is ‘dict object has no attribute elements’.

Is this an error in my use…?

Thanks in advance for the help.

-Jack