freelabz/secator

fix (cli): duplicate `Runner.__init__` when running from CLI

Opened this issue · 0 comments

When running a task from CLI, we end up getting a double Runner.init:

Execution stack:

secator x httpx <TARGET>

task = Task(*args, **kwargs)

-> Task.__init__ [not implemented]
   -> Runner.__init__
      -> Set class attributes (output_*, print_*, result, uuid, context, progress, status, output) last_*, *_time, done, exporters, sync, delay, _hooks, ...)
      -> Create reports folder
      -> Set config
      -> Set uuid
-> Task.yielder
   -> Get task name (e.g: `httpx`)
   -> Instantiate actual task class: e.g httpx(target, **run_opts)
      -> httpx.__init__ [not defined]
         -> Command.__init__
            -> Runner.__init__
               -> Set class attributes
               -> Create reports folder
               -> Set config
               -> Set uuid
      -> httpx.yielder [not implemented]
         -> Command.yielder
            -> Runs the actual command

Need to figure out if it's not too convoluted.