dffml icon indicating copy to clipboard operation
dffml copied to clipboard

df: types: dataflow: Call update any time any subproperty of flow is modified

Open pdxjohnny opened this issue 2 years ago • 1 comments

Pain Point

Currently when a use modifies dataflow.flow the dataflow is not updated unless dataflow.update() is called.

For example:

https://github.com/intel/dffml/blob/8c87efaf55707bf1c3f72406226de85111fb7681/examples/io/io_usage.py#L11-L49

Proposed Solution

Ideally whenever flow is modified, or any subproperty all the way down the nested objects is modifed. We would automatically call dataflow.update() so the user doesn't have to remember to call it.

The following code might be helpful from the config code paths. We have leveraged getters and setters to do validation on properties. We could possibly take a similar with flow, we might have to ensure each object within flow has a reference to the dataflow it's within. If an object was instantiated as above, we might be able to detect it from the parent it was added to, going all the way up to the flow object, and add down a reference to the dataflow, so the object can call update, as well as then calling update due to that addition of a property.

https://github.com/intel/dffml/blob/8c87efaf55707bf1c3f72406226de85111fb7681/dffml/base.py#L366-L451

pdxjohnny avatar Feb 20 '22 04:02 pdxjohnny

Hey @pdxjohnny, in https://github.com/intel/dffml/blob/8c87efaf55707bf1c3f72406226de85111fb7681/examples/io/io_usage.py#L30, why is .update used instead of assignment?

TirelessClock avatar Mar 25 '22 08:03 TirelessClock