def delete_job(self, job, recursive=True, add_dependencies=False):
    'Delete given job from DAG.'
    if (job in self.targetjobs):
        self.targetjobs.remove(job)
    if add_dependencies:
        for _job in self.dependencies[job]:
            self.targetjobs.add(_job)
    for job_ in self.depending[job]:
        del self.dependencies[job_][job]
    del self.depending[job]
    for job_ in self.dependencies[job]:
        depending = self.depending[job_]
        del depending[job]
        if ((not depending) and recursive):
            self.delete_job(job_)
    del self.dependencies[job]
    if (job in self._needrun):
        self._len -= 1
        self._needrun.remove(job)
        del self._reason[job]
    if (job in self._finished):
        self._finished.remove(job)
    if (job in self._dynamic):
        self._dynamic.remove(job)
    if (job in self._ready_jobs):
        self._ready_jobs.remove(job)
    for f in job.output:
        try:
            del self.job_cache[(job.rule, f)]
        except KeyError:
            pass
Delete given job from DAG.
def delete_job(self, job, recursive=True, add_dependencies=False):
    
    if (job in self.targetjobs):
        self.targetjobs.remove(job)
    if add_dependencies:
        for _job in self.dependencies[job]:
            self.targetjobs.add(_job)
    for job_ in self.depending[job]:
        del self.dependencies[job_][job]
    del self.depending[job]
    for job_ in self.dependencies[job]:
        depending = self.depending[job_]
        del depending[job]
        if ((not depending) and recursive):
            self.delete_job(job_)
    del self.dependencies[job]
    if (job in self._needrun):
        self._len -= 1
        self._needrun.remove(job)
        del self._reason[job]
    if (job in self._finished):
        self._finished.remove(job)
    if (job in self._dynamic):
        self._dynamic.remove(job)
    if (job in self._ready_jobs):
        self._ready_jobs.remove(job)
    for f in job.output:
        try:
            del self.job_cache[(job.rule, f)]
        except KeyError:
            pass