substra-tests icon indicating copy to clipboard operation
substra-tests copied to clipboard

cp.list_traintuple doesn't return tuple in their creation order

Open jmorel opened this issue 4 years ago • 2 comments

In test_execution_compute_plan.py, multiple tuples specs are generated (e.g. tuple_spec_1 and tuple_spec_2) and once created, the matching tuples are retrieved using:

tuple_1, tuple_2 = cp.list_tuple()

However there is no guarantee that tuple_1 matches tuple_spec_1 here. Our tests work because the tuple are chained and therefore have ever-increasing ranks and because the list_tuple methods all sort the tuple by rank. Without that, our checks would fail.

jmorel avatar Jul 02 '20 14:07 jmorel

This issue cannot be solved in tests because the solution would rely on the ID to KEY mapping, which is our only way of linking a spec with an asset.

Unfortunately the mapping is only returned after create or update calls, not for get and list calls. And the SDK always does a get right after a create or update to avoid having to deal with multiple return formats. Which means the mapping is lost forever.

jmorel avatar Jul 02 '20 14:07 jmorel

At this point it would be a good think to know how we want to interact with the ID to Key mapping and open a companion issue the chaincode to implement it. Of course it can include a much larger discussion about using user generated ID to retrieve all kind of asset.

thibaultrobert avatar Jul 03 '20 07:07 thibaultrobert