iot-lab / cli-tools

IoT-LAB CLI tools
Other
17 stars 14 forks source link

Fix: TypeError calling _load_assocs on previously exported experiment #18

Closed dadada closed 6 years ago

dadada commented 6 years ago

Exporting an experiment using the GET method creates a JSON file that contains the fields profiles and mobilities. When _load_assocs gets called on the arguments obtained from the exported JSON file, these two parameters are passed as additional keyword arguments and a TypeError occurs.

This can be reproduced using the example from experiment-cli load --help

$ experiment-cli get -i 192 -a
$ tar -xzvf 192.tar.gz
$ experiment-cli load -f 192/192.json
fsaintma commented 6 years ago

Hi @timschubert , thanks for your pull request.

You are right and there is a bug when you load the experiment JSON file if it contains mobilities or profiles attributes. When you submit an experiment and specify a profile or mobility association with an empty profiles or mobilities JSON attribute the IoT-LAB REST API try to fill them automatically with your profiles or mobilities store.

But originally we also want that you should submit an experiment with a profile not included in your store and put it directly in the JSON profiles attribute. In this case we just verify that you put a valid profile.

So for your fix, rather than delete attributes it might be better to affect them in experiment object (eg. pop of exp_dict) before load_assoc execution if they exist.

What do you think about that ?

Thanks for your help.

fsaintma commented 6 years ago

Thanks @timschubert. I will merge this pull request and deploy a new Cli-tools version (eg. 2.4.2) on IoT-LAB testbed. Best regards.