Skip to content

Passing objects through the stack #8

@NicolasGensollen

Description

@NicolasGensollen

When writing a stack for the metric computation, I faced the following situation:

layer network_split:

create a network_analyzer object with the model received from previous layer:

net_analyzer = network_analyzer(model) #This is kinda slow...

and do some modifications:

net_analyzer.do_something() #Modifs that split the network into feeders

and finally returns:

return network_analyzer.model

layer compute_metrics

Receives the model from the network_split layer, but has to re-create an instance of network_analyzer to compute the metrics:

net_analyzer = network_analyzer(model) #This is (again) kinda slow...
net_analyzer.compute_metrics()
net_analyzer.export()

This means that we end up doing something slow twice when running the stack.

A quick and dirty fix I made was to allow the metric computation to happen in the network_split layer (see bd5e8f5), but it'd be nice to have a cleaner solution. Especially since we need to have a layer dedicated to the metric computation itself. It looks like being able to pass the network_analyzer from one layer to another through the stack (like what is done with the model) would solve this.

I an unsure about the feasibility and complexity of such a change though. And even if possible, this might be something that we don't want to allow.

Thoughts??

Metadata

Metadata

Labels

enhancementNew feature or requestquestionFurther information is requested

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions