clearml: Fix for deferred_init in Task.init is incorrect

Describe the bug

I’m not 100% sure, but we noticed this is an aside in our flow. In this commit, the applied change does not produce the desired results AFAICS.

Original had deferred_init != 0 (where deferred_init is a boolean argument for Task.init), and the updated has not (type(deferred_init) == int and deferred_init == 0). This can also be written as type(deferred_init) != int or deferred_init != 0, which then always evaluates to True for the earlier clause (since the input argument is boolean).

One must wonder, in this specific case, why not compare the boolean to booleans with e.g. deferred_init is True?

To reproduce

No real useful code to reproduce, but simply:

deferred_init = False
deferred_init != 0  # False
not (type(deferred_init) == int and deferred_init == 0)  # True

Environment

  • ClearML SDK Version 1.8.3
  • Python Version 3.10

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 16 (16 by maintainers)

Commits related to this issue

Most upvoted comments

@idantene,

Sorry I think I wasn’t clear. Yes I reproduced your bug and I gave it to the dev team to figure out what is happening. I’ll update here once we figure it out.

I just wanted to understand, why did you resort to this hack: clearml.config.remote.override_current_task_id(None)

@idantene,

Thanks for the detailed write-up, let me see if I get you correctly 😃

You’re trying to have a remote task start more tasks and you can’t so you “hacked” it. Can you elaborate what you tried and what didn’t work? Although it’s not related to this issue, maybe we can (and should) fix this but I’d like to understand what you tried first.

I tried your code and indeed something broke, not really sure why, and not sure it’s related to deferred init (as it’s set to false anyway). I will provide this to the dev team and see what did we change