MNT Improve handling of custom-defined results from TaskParameter
models.
#51
Labels
invalid
This doesn't seem right
TaskParameter
models.
#51
Description
TaskParameter
models can define the result of the associatedTask
to be an arbitrary combination of parameters (or other features) by using theresult_from_params
field stored in theTaskParameters.Config
configuration class.We should improve the way this is done.
Issue
Currently, the documented mechanism for storing information in this field is to use a custom validator to update the class variable (
TaskParameters.Config.result_from_params
).The class variable needs to be converted to an instance variable of the parameter model during initialization of a
Task
instance. This is because no instance of theConfig
class is stored in the parameters model (only the class definition). Updates to the class variables within theConfig
class do not survive pickling, since by choice, pickle will not save code or class variables. This means when the validated model is pickled and sent to theExecutor
, the changes toresult_from_params
introduced by the custom validator would be lost upon unpickling.To avoid this, the above conversion to an instance variable is done. This requires, in turn, skipping over the new instance variable when either
ThirdPartyTask
's or theExecutor
are inspecting the model. E.g. theThirdPartyTask
must make sure not to passresult_from_params
as a command-line argument.Ideally, this complicated mechanism would be simplified.
Documentation must be updated to reflect any new mechanism.
Note: This may necessitate changes to the
run_directory
mechanism as well. However,run_directory
does not suffer from this problem since that information is only used by theTask
, so it is fine if lost during pickling.The text was updated successfully, but these errors were encountered: