You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Properties are set using setattr in the generate_tasks_from_spec function. There are a couple of downsides to this:
Cannot set non-alphanumeric properties. For example, one might want to pass alpha.beta to the spawner in order to set properties in multi-level input files.
There is no check on hasattr which means that if the property does not exist it just adds a Python property (see issue Task creation should fail if spawner doesn't have property #109). If we put a requirement on the property existing then this does not allow spawners to be dynamic in the sense that they must declare all the properties upfront.
Solution: generate_tasks_from_spec takes two additional default argument getter and setter, which default to getattr and setattr respectively but could also be __getitem__ and __setitem__.
It might make sense to redesign this function into a callable TaskGenerator class.
Properties are set using
setattrin thegenerate_tasks_from_specfunction. There are a couple of downsides to this:alpha.betato the spawner in order to set properties in multi-level input files.hasattrwhich means that if the property does not exist it just adds a Python property (see issue Task creation should fail if spawner doesn't have property #109). If we put a requirement on the property existing then this does not allow spawners to be dynamic in the sense that they must declare all the properties upfront.Solution:
generate_tasks_from_spectakes two additional default argumentgetterandsetter, which default togetattrandsetattrrespectively but could also be__getitem__and__setitem__.It might make sense to redesign this function into a callable
TaskGeneratorclass.