Open unkcpz opened 3 years ago
FYI the explicit inputs of WorkChain is:
from aiida_optimize.engines._convergence import Convergence
inputs = {
'engine':
Convergence,
'engine_kwargs':
orm.Dict(
dict={
'input_values': input_values,
'tol': 1e-6,
'conv_thr': 1e-6,
'input_key': 'parameters.ecutwfc',
'result_key': 'evaluate__result.relative_diff',
'convergence_window': 2
}),
'evaluate_process':
CreateEvaluateWorkChain,
'evaluate':
create_evaluate_inputs,
}
from aiida.engine import run
workchain = run(OptimizationWorkChain, **inputs)
Not sure that's what's happening here, but worth a try: The inputs which are classes (e.g. Convergence
, or CreateEvaluateWorkChain
) are actually orm.Str
inputs, and automatically serialized by aiida-optimize
.
When the input is nested, this no longer works and you need to explicitly serialize it to Str
, by wrapping them in aiida_tools.process_inputs.get_fullname
(from https://github.com/greschd/aiida-tools/blob/master/aiida_tools/process_inputs.py#L27) .
Most probably, it's the CohesiveEnergyWorkChain
inside create_evaluate_inputs
that needs to be wrapped here.
@greschd That's true. get_fullname
sove my issue. Thanks a lot!
BTW, maybe we can have a more explainable exception.
Yeah this is definitely too cryptic, I remember struggling for a while when I first encountered it.
Not sure if we have control over the traceback right here or if it could be improved in aiida-core
.
Maybe things could also be improved w.r.t. documentation, or maybe the automatic serialization should be (slowly) deprecated to make it less surprising.
Anyway, I'll reopen for now to remind myself that this should be improved; will probably be a separate issue eventually.
I got an error when I using
Convergence
WorkChain withCreateEvaluationWorkChain
to combine a WorkChain and a evaluate calcfunction process. The exception is long so I only paste part of it.I also print the
data
here when the exception happened.data
is my WorkChain<class 'aiida_sssp_workflow.workflows.cohesive_energy.CohesiveEnergyWorkChain'>
anddata.__reduce__ex__(2)
is<method '__reduce_ex__' of 'object' objects>
.Tagging @greschd @zooks97 for inputs. I have no idea whats going on :crying_cat_face: