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.
The text was updated successfully, but these errors were encountered:
Properties are set using
setattr
in thegenerate_tasks_from_spec
function. There are a couple of downsides to this:alpha.beta
to the spawner in order to set properties in multi-level input files.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 argumentgetter
andsetter
, which default togetattr
andsetattr
respectively but could also be__getitem__
and__setitem__
.It might make sense to redesign this function into a callable
TaskGenerator
class.The text was updated successfully, but these errors were encountered: