Skip to content

Rework serialization of parameter sweep configuration#15

Merged
tinevez merged 5 commits into
masterfrom
rework-serialization
Jul 10, 2025
Merged

Rework serialization of parameter sweep configuration#15
tinevez merged 5 commits into
masterfrom
rework-serialization

Conversation

@tinevez
Copy link
Copy Markdown
Member

@tinevez tinevez commented Jul 10, 2025

This PR introduces the following 'quality of life' improvements for the user:

When a user launch the plugin in a location that contains a helperrunnersettings.json file, it deserializes it to present the user with last used parameter sweep configuration.

But sometimes users may have serialized that the module was not available or properly configured at the time of serialization. For instance if you did not install TrackMate-Trackastra, the fact that it is missing will be serialized. And it will be deserialized, even if the TrackMate-Trackastra module has become available.

Now when deserializing, we detect whether we serialized such a case, and if yes, we try to re-discover the module.

We now have a special parameter for conda environments. The list of conda environments available is still serialized, but it is ignored when deserializing, and replaced with the list of actual conda environments present at runtime.

The serialization logic is still complicated. I could not find a good way to simplify it keeping everything we want for the user.
I tried to at least clarify it a bit, and use non-conflicting class names.

tinevez added 5 commits April 30, 2025 09:43
All deserialized models have listeners that need to be initialized
and registered to the main ParameterSweepModel. But when deserializing
Gson, the constructor of the base class is not called, and the
listeners are not re-registered.

We try to work around this in a better way:
- The listeners field is initialized in the class definition, not in the
constructor.

But this does not work all the time either. For a reason that completely
escapes me, sometimes an instance will not have this field initialized.
Weird.

- A default visibility method is called by the Gson deserialization
logic to re-register the listeners to the main model.
- The param models have also an initialize() method that recreates
the listeners.
- Special case for CondaEnvParamSweepModel: the env list is cleared
after deserialization and replaced by the env list discovered at
runtime.
- Also: all RangeType enums have been renamed according to what is their
mother param type for clarity.
We may have serialized that the module was not available or
properly configured at the time of serialization. In that
case, the submodel is only one information parameter. Instead
of returning it, we try to instantiate a new model, so that
the user is presented something par with the current
configuration they have.
@tinevez tinevez merged commit d9ac2a9 into master Jul 10, 2025
1 check failed
@tinevez tinevez deleted the rework-serialization branch July 10, 2025 13:53
@tinevez tinevez changed the title Rework serialization. of parameter sweep. Rework serialization of parameter sweep configuration Jul 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant