def run(cls, **kwargs):
        """
        Create a command object by issuing a POST request to the /command endpoint
        Waits until the command is complete. Repeatedly polls to check status

        Args:
            `**kwargs`: keyword arguments specific to command type

        Returns:
            Command object
        """

        # vars to keep track of actual logs bytes (err, tmp) and new bytes seen in each iteration
        err_pointer, tmp_pointer, new_bytes = 0, 0, 0
        print_logs_live = kwargs.pop("print_logs_live", None) # We don't want to send this to the API.

        cmd = cls.create(**kwargs)

        sighandler = SignalHandler()

        while not Command.is_done(cmd.status):
            if sighandler.received_term_signal:
                logging.warning("Received signal {}. Canceling Qubole Command ID: {}".format(sighandler.last_signal, cmd.id))
                cls.cancel(cmd)
                exit()
            time.sleep(Qubole.poll_interval)
            cmd = cls.find(cmd.id)
            if print_logs_live is True:
                log, err_length, tmp_length = cmd.get_log_partial(err_pointer, tmp_pointer)

                # if err length is non zero, then tmp_pointer needs to be reset to the current tmp_length as the
                # err_length will contain the full set of logs from last seen non-zero err_length.
                if err_length != "0":
                    err_pointer += int(err_length)
                    new_bytes = int(err_length) + int(tmp_length) - tmp_pointer
                    tmp_pointer = int(tmp_length)
                else:
                    tmp_pointer += int(tmp_length)
                    new_bytes = int(tmp_length)

                if len(log) > 0 and new_bytes > 0:
                    print(log[-new_bytes:], file=sys.stderr)

        return cmd
Create a command object by issuing a POST request to the /command endpoint
        Waits until the command is complete. Repeatedly polls to check status

        Args:
            `**kwargs`: keyword arguments specific to command type

        Returns:
            Command object