Using one's own generator class, i.e. for implementing a pyemma analysis script, does not work as described in notebook 5. First, their are several bugs in the notebook itself. Substituting the given my_generator.py by e.g. (just as a non-sense minimal example, important are the imports...)
from adaptivemd.generator import TaskGenerator
from adaptivemd.task import PythonTask
class MDTrajFeaturizer(TaskGenerator):
def __init__(self):
super(MDTrajFeaturizer, self).__init__()
@staticmethod
def then_func(project, task, data, inputs):
# add the output for later reference
project.data.add(data)
def execute(self):
t = PythonTask(self)
t.call(
my_script,
param1='',
param2=''
)
return t
def my_script(param1, param2):
return {"whatever you want to return"}
and, inside the notebook, registering it in the db
from my_generator import MDTrajFeaturizer
project.storage.update_storable_classes()
seems to fix some of the errors. If I'm not wrong, also the file itself needs to be added to the project, which I did with
File('file://my_generator.py').load()
Now, according to project.storage.simplifier.class_list, the class is registered. Still, when I start a worker with a task from this generator, I get
...
File "/storage/mi/thempel/adaptive_MD_test/adaptivemd/adaptivemd/mongodb/dictify.py", line 250, in build
obj['_cls'])
ValueError: Cannot create obj of class `MDTrajFeaturizer`.
Class is not registered as creatable! You might have to define
the class locally and call `update_storable_classes()` on your storage.
Any ideas? @marscher @jhprinz @euhruska
Using one's own generator class, i.e. for implementing a pyemma analysis script, does not work as described in notebook 5. First, their are several bugs in the notebook itself. Substituting the given
my_generator.pyby e.g. (just as a non-sense minimal example, important are the imports...)and, inside the notebook, registering it in the db
seems to fix some of the errors. If I'm not wrong, also the file itself needs to be added to the project, which I did with
Now, according to
project.storage.simplifier.class_list, the class is registered. Still, when I start a worker with a task from this generator, I getAny ideas? @marscher @jhprinz @euhruska