clearml icon indicating copy to clipboard operation
clearml copied to clipboard

task.connect_configuration does not preserve JSONs

Open SkBlaz opened this issue 2 years ago • 4 comments

Hello ClearML team,

first off, great work with the project, very nice functionality. Writing with a small detail that we observed can cause some time to get around, yet seems directly fixable (if you can point me to the relevant part of the repo can do this myself) - when pushing configs to ClearML via

task.connect_configuration(some_obj)

the some_obj, if str, simply doesn't get pushed. We'd like to have e.g., proper JSONs pushed, however, this is currently not possible (e.g., json.dumps(some_dict)) won't work. It seems at least an optional flag that would enable displaying strings as they are could be beneficial for users. Thanks for checking this/advice on how to proceed. Note that one can overcome this by overloading the description, however this seems like an anti-pattern.

SkBlaz avatar Aug 28 '23 08:08 SkBlaz

Hi @SkBlaz ! You could dump the string to a file or just connect some_dict directly (the SDK will call json.dumps on it eventually).

Are you sure it calls json.dumps? It seems in the interface the resulting structures are not proper JSONs (but some stripped-down form). Thanks for the filedump tip, this will do the trick also!

SkBlaz avatar Aug 28 '23 12:08 SkBlaz

@SkBlaz It actually sometimes calls json.dumps (in some edge cases). Anyways, the form you see is called HOCON, which supersets json.

Ok thanks - this explains it indeed. So the suggested way to go here is to convert hocon to json when the need arises?

SkBlaz avatar Aug 29 '23 04:08 SkBlaz