Skip to content

Commit

Permalink
Merge pull request #691 from Dessia-tech/fix/variables-setup
Browse files Browse the repository at this point in the history
fix(workflow): horrible hotfix to avoid NBVs type deserialization as …
  • Loading branch information
GhislainJ committed May 3, 2024
2 parents 71bbb94 + 21a3b90 commit 29e7724
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .pyenchant_dessia.dict
Expand Up @@ -28,6 +28,7 @@ dectree
dendrogram
deserialization
deserialize
deserialized
dessia
DessiaObject
dict
Expand All @@ -43,6 +44,7 @@ floatarg
Frobenius
frontend
hlist
hotfix
ge
getsizeof
gt
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## 0.16.5

### HOTFIX

- Workflow : Reset NBVs type to last downstream one found while regenerating workflow pipes from deserialization

## 0.16.4

### Fix
Expand Down
10 changes: 10 additions & 0 deletions dessia_common/workflow/core.py
Expand Up @@ -2017,6 +2017,16 @@ def deserialize_pipes(pipes_dict, blocks, nonblock_variables, connected_nbvs):
ib2, _, ip2 = target
variable2 = blocks[ib2].inputs[ip2]

if connected_nbvs.get(variable1, False):
# TODO This is an horrible hotfix to prevent NBVs type to be wrongly deserialized as strings.
# We MUST refactor non_block_variables to allow them to be detached and remove detached variables concept.
# The detached variable concept is completely flawed. NBVs MUST be able to exist without downstream blocks
# This is plainly wrong because a NBV could be linked to several input ports with concurrent types
# (by inheritance for example). Here we are resetting the NBV type to whatever we find last.
# All in all, as block reset their input every time (trust user code instead of frontend json),
# this is a way to reset NBVs type to user-code value and avoiding deserialization as string,
# which are two completely different issues.
variable1.type_ = variable2.type_
pipes.append(Pipe(variable1, variable2))
return pipes

Expand Down

0 comments on commit 29e7724

Please sign in to comment.