             .done =>
                 @fetchResourceUsage() if @models.task.get('isStillRunning')
             .success =>
-                requestId = @models.task.attributes.task.taskRequest.request.id
-                deployId = @models.task.attributes.task.taskRequest.deploy.id
-                deployInfo = new DeployDetails
-                  deployId: deployId
-                  requestId: requestId
-                deployInfo.fetch().success =>
-                    alerts = @getAlerts deployInfo
-                    @collections.alerts.reset()
-                    for alert in alerts
-                        @collections.alerts.add alert
+                @getAlerts()
             .error =>
                 # If this 404s the task doesn't exist
                 app.caughtError()
                 app.router.notFound()
-
 
         if @collections.s3Logs?.currentPage is 1
             @collections.s3Logs.fetch().error =>

            killedMessage = updates.filter (u) =>
                return u.taskState == 'TASK_KILLED'
            if decomMessage.length > 0 and killedMessage.length > 0
                alerts.push
                  title: 'Alert:',
                  message: 'This task was killed due to a slave decommissioning.',
                  level: 'danger'
        return alerts

    refresh: ->
        @resourcesFetched = false

                app.caughtError()
                delete @models.resourceUsage

    getAlerts: =>
        @collections.alerts.reset()
        task = @models.task
        requestId = @models.task.attributes.task.taskRequest.request.id
        deployId = @models.task.attributes.task.taskRequest.deploy.id
        # Is this a scheduled task that has been running much longer than previous ones?
        if task.attributes.task.taskRequest.request.requestType == 'SCHEDULED' and task.get('isStillRunning')
            deployInfo = new DeployDetails
              deployId: deployId
              requestId: requestId
            deployInfo.fetch().success =>
                avg = deployInfo.get('deployStatistics')?.averageRuntimeMillis
                current =  new Date().getTime() - task.get('task').taskId.startedAt
                threshold = window.config.warnIfScheduledJobIsRunningPastNextRunPct / 100
                # Alert if current uptime is longer than the average * the configurable percentage
                if current > (avg * threshold)
                    @collections.alerts.add
                      title: 'Warning:',
                      message: "This scheduled task has been running longer than <code>#{threshold}</code> times the average for the request and may be stuck.",
                      level: 'warning'
        # Was this task killed by a decommissioning slave?
        if !task.get('isStillRunning')
            updates = task.get('taskUpdates')
