Runs an instance of a scheduled task

def run(self, schedule_id, auth_token, endpoint, payload, **kwargs):
        """
        Runs an instance of a scheduled task
        """
        log = self.get_logger(**kwargs)
        log.info("Running instance of <%s>" % (schedule_id,))
        if self.request.retries > 0:
            retry_delay = utils.calculate_retry_delay(self.request.retries)
        else:
            retry_delay = self.default_retry_delay

        headers = {"Content-Type": "application/json"}
        if auth_token is not None:
            headers["Authorization"] = "Token %s" % auth_token
        try:
            response = requests.post(
                url=endpoint,
                data=json.dumps(payload),
                headers=headers,
                timeout=settings.DEFAULT_REQUEST_TIMEOUT,
            )
            # Expecting a 201, raise for errors.
            response.raise_for_status()
        except requests_exceptions.ConnectionError as exc:
            log.info("Connection Error to endpoint: %s" % endpoint)
            fire_metric.delay("scheduler.deliver_task.connection_error.sum", 1)
            self.retry(exc=exc, countdown=retry_delay)
        except requests_exceptions.HTTPError as exc:
            # Recoverable HTTP errors: 500, 401
            log.info("Request failed due to status: %s" % exc.response.status_code)
            metric_name = (
                "scheduler.deliver_task.http_error.%s.sum" % exc.response.status_code
            )
            fire_metric.delay(metric_name, 1)
            self.retry(exc=exc, countdown=retry_delay)
        except requests_exceptions.Timeout as exc:
            log.info("Request failed due to timeout")
            fire_metric.delay("scheduler.deliver_task.timeout.sum", 1)
            self.retry(exc=exc, countdown=retry_delay)

        return True