Mark a task (and anything that depends on it) as failed.

        name: The name of the offending task
554746
def _cascade_failure(self, name):
        
        if name in self._graph:
            self._failed.update(
                self._graph.remove(name, strategy=Strategy.remove)
            )
        else:
            self._failed.add(name)
652224
def fail(title, message=nil)
      $stderr.puts title
      $stderr.puts message || title
      if @client
        @client.stop { AuditStub.instance.stop { exit(1) } }
      else
        exit(1)
      end
    end
305791
def mark_failed
      return false unless link? :mark_failed
      InvoiceCollection.from_response follow_link(:mark_failed)
    rescue Recurly::API::UnprocessableEntity => e
      raise Invalid, e.message
    end
1178227
def apply_signature(cls, instance, async=True, countdown=None, is_heavy_task=False, **kwargs):
        
        serialized_instance = utils.serialize_instance(instance)

        signature = cls.get_task_signature(instance, serialized_instance, **kwargs)
        link = cls.get_success_signature(instance, serialized_instance, **kwargs)
        link_error = cls.get_failure_signature(instance, serialized_instance, **kwargs)

        if async:
            return signature.apply_async(link=link, link_error=link_error, countdown=countdown,
                                         queue=is_heavy_task and 'heavy' or None)
        else:
            result = signature.apply()
            callback = link if not result.failed() else link_error
            if callback is not None:
                cls._apply_callback(callback, result)

        return result.get()
819232
def do_retry(self, args):
        ''''''
        work_spec_name = self._get_work_spec_name(args)
        retried = 0
        complained = False
        try:
            if args.all:
                while True:
                    units = self.task_master.get_work_units(
                        work_spec_name, limit=1000,
                        state=self.task_master.FAILED)
                    units = [u[0] for u in units]  # just need wu key
                    if not units: break
                    try:
                        self.task_master.retry(work_spec_name, *units)
                        retried += len(units)
                    except NoSuchWorkUnitError, e:
                        # Because of this sequence, this probably means
                        # something else retried the work unit.  If we
                        # try again, we shouldn't see it in the failed
                        # list...so whatever
                        pass
            else:
                units = args.unit
                try:
                    self.task_master.retry(work_spec_name, *units)
                    retried += len(units)
                except NoSuchWorkUnitError, e:
                    unit = e.work_unit_name
                    self.stdout.write('No such failed work unit {0!r}.\n'
                                      .format(unit))
                    complained = True
                    units.remove(unit)
                    # and try again
        except NoSuchWorkSpecError, e:
            # NB: you are not guaranteed to get this, especially with --all
            self.stdout.write('Invalid work spec {0!r}.\n'
                              .format(work_spec_name))
            return
        if retried == 0 and not complained:
            self.stdout.write('Nothing to do.\n')
        elif retried == 1:
            self.stdout.write('Retried {0} work unit.\n'.format(retried))
        elif retried > 1:
            self.stdout.write('Retried {0} work units.\n'.format(retried))
1096034
function message(worker, task) {
    var callback = worker.queue[task.id]
      , err;

    // Rebuild the Error object so we can pass it to our callbacks
    if (task.err) {
      err = new Error(task.err.message);
      err.stack = task.err.stack;
    }

    // Kill the whole fucking system, we are in a fucked up state and should die
    // badly, so just throw something and have the process.uncaughtException
    // handle it.
    if (!callback) {
      if (err) console.error(err);
      console.error(task);
      throw new Error('Unable to process message from worker, can\'t locate the callback!');
    }

    callback(err, task);
    delete worker.queue[task.id];
  }
543135
function error(err) {
      this.log(`${chalk.red(`${err.name.toLowerCase()}:`)} ${err.message}`);
    }
823238
def _get_task(name):
	''''''
	matches = [x for x in TASKS if x.match(name)]
	if matches:
		return matches[0]
255506
def _start_if_ready(self, task_name):
        
        logger.debug('Job {0} running _start_if_ready for task {1}'.format(self.name, task_name))
        task = self.tasks[task_name]
        dependencies = self._dependencies(task_name, self.snapshot)
        for dependency in dependencies:
            if self.run_log['tasks'].get(dependency, {}).get('success', False) == True:
                continue
            return
        self._put_task_in_run_log(task_name)
        task.start()
1262209
def print_task_help(self, task, name):
        
        TerminalColor.set('GREEN')
        print(get_signature(name, task))

        # TODO: print the location does not work properly and sometimes returns None
        # print('    => defined in: {}'.format(inspect.getsourcefile(task)))
        help_msg = inspect.getdoc(task) or ''
        TerminalColor.reset()
        print('   ' + help_msg.replace('\n', '\n   '))
        TerminalColor.reset()
        print()
1067190
def on_failure(self, exc, task_id, args, kwargs, einfo):
        
        key = self._get_cache_key(args, kwargs)
        _, penalty = cache.get(key, (0, 0))
        if penalty < self.MAX_PENALTY:
            penalty += 1

        logger.debug('The task %s is penalized and will be executed on %d run.' % (self.name, penalty))
        cache.set(key, (penalty, penalty), self.CACHE_LIFETIME)
        return super(PenalizedBackgroundTask, self).on_failure(exc, task_id, args, kwargs, einfo)
661317
function (task) {
  return function (err) {
    notify.onError({
      message: task + ' failed, check the logs',
      sound: false
    })(err);
    gutil.log(gutil.colors.bgRed(task + ' error:'), gutil.colors.red(err));
  };
}
889908
def uninstall_task(self, name):
    
    if name in self._task_type_by_name:
      self._task_type_by_name[name].options_scope = None
      del self._task_type_by_name[name]
      self._ordered_task_names = [x for x in self._ordered_task_names if x != name]
    else:
      raise GoalError('Cannot uninstall unknown task: {0}'.format(name))
159119
def fail(self, message, param=None, ctx=None):
        """"""
        raise BadParameter(message, ctx=ctx, param=param)
449932
public synchronized void notifyTaskFailure(long jobId, int taskId, String errorMessage) {
    Pair<Long, Integer> id = new Pair<>(jobId, taskId);
    TaskInfo.Builder taskInfo = mUnfinishedTasks.get(id);
    taskInfo.setStatus(Status.FAILED);
    taskInfo.setErrorMessage(errorMessage);
    finishTask(id);
    LOG.info("Task {} for job {} failed: {}", taskId, jobId, errorMessage);
  }
539606
def dependency_failed(test, results):
        """"""
        for d in (NoseDepUtils.test_name(i) for i in dependencies[test]):
            if results.get(d) and results.get(d) != 'passed':
                return "Required test '{}' {}".format(d, results.get(d).upper())
        return None
17389
public void recordFailedTask(String trackerName) {
    synchronized (this) {
      NodeUsageReport usageReport = getReportUnprotected(trackerName);
      usageReport.setNumFailed(usageReport.getNumFailed() + 1);
    }
  }