Feature/resolve timelines - #62
Conversation
Signature accepts a Sequence, but the logic previously only worked when providing a list. Other sequences silently didn't work.
Add `parent` property and `relative_to` (inspired by pathlib.Path)
N.B. Resolving imports doesn't rename components (only models) and therefore shouldn't rename timelines. Edit: thinking a bit more about this, I'm not sure if we must rename timelines when flattening the hierarchical models:
|
Include information on the conduits instead of just the components. Example error message: > Detected a dependency cycle in model 'cycle'. The component 'first' has an F_INIT port that depends on data produced by one of its own O_F or O_I ports: Conduit(first.final -> second.init) -> Conduit(second.final -> third.init) -> Conduit(third.final -> first.init). You may have an error in the conduits or may need a different coupling schema.
|
N.B. I've improved the cyclic dependency error, hopefully this is clear enough without writing and pointing to a new documentation page. |
Imagine a top-level model with two components After flattening, we have a flat model with components
Timelines on ports are usually relative timelines, and those shouldn't be a problem as long as the absolute timeline they're appended to is correct. They can interact with components outside the model just fine though, we can have a component |
LourensVeen
left a comment
There was a problem hiding this comment.
Definitely headed in the right direction, nice work!
Based on PR feedback
Yes, fully agreed! For complete correctness you'd have to rename these internal timelines. My point (which I didn't describe clearly, sorry for that!) was that timeline renaming isn't required for the checks in this PR. The flattened model is more of an internal MUSCLE3 state and I expect it's not required to have the renaming functionality in to get a properly behaving simulation. We'll have to test though 🙂 |
|
Ah, and after flattening the timelines aren't actually used anyway, so it would work even if we don't update them during flattening. Yes, I think that's right. And components don't get renamed during resolving, so there's no issue there either. All good. |
LourensVeen
left a comment
There was a problem hiding this comment.
A few suggestions, but I think this is good to go?
| model. Any of the following exceptions (which are a subclass of | ||
| :class:`ResolveTimelineException`) will be raised when the model timelines are not | ||
| consistent. See their description for more details: | ||
|
|
There was a problem hiding this comment.
You can use a Raises: section for this similar to Args: to make Sphinx render it nicely:
Raises:
:class:`CyclicDependency` if an O_F to F_INIT loop was found
:class:`TooManyReducerFilters` if a timeline was reduced by more levels than it has
|
|
||
|
|
||
| class CyclicDependency(RuntimeError): | ||
| class ResolveTimelineException(RuntimeError): |
| This error is raised when a reducer filter attempts to reduce a conduit that | ||
| already sends on the root timeline. :class:`InconsistentTimelines` or | ||
| :class:`ConduitTimelineError` may also be raised when too many reducer filters are | ||
| applied. |
There was a problem hiding this comment.
"... if that doesn't reduce the timeline beyond the root timeline."
Continuation of PR #27
Update timeline annotations when importing/resolving (components are renamed tox.y.<component>and timeline annotations should as well to prevent clashes)v0_2.validation.timelines. Function:resolve_timelines()because it updates the timelines on the data objects