def update_needrun(job):
    reason = self.reason(job)
    noinitreason = (not reason)
    updated_subworkflow_input = self.updated_subworkflow_files.intersection(job.input)
    if (((job not in self.omitforce) and (job.rule in self.forcerules)) or (not self.forcefiles.isdisjoint(job.output))):
        reason.forced = True
    elif updated_subworkflow_input:
        reason.updated_input.update(updated_subworkflow_input)
    elif (job in self.targetjobs):
        if ((not job.output) and (not job.benchmark)):
            if job.input:
                if job.rule.norun:
                    reason.updated_input_run.update([f for f in job.input if (not f.exists)])
                else:
                    reason.nooutput = True
            else:
                reason.noio = True
        else:
            if (job.rule in self.targetrules):
                missing_output = job.missing_output()
            else:
                missing_output = job.missing_output(requested=(set(chain(*self.depending[job].values())) | self.targetfiles))
            reason.missing_output.update(missing_output)
    if (not reason):
        output_mintime_ = output_mintime.get(job)
        if output_mintime_:
            updated_input = [f for f in job.input if (f.exists and f.is_newer(output_mintime_))]
            reason.updated_input.update(updated_input)
    if (noinitreason and reason):
        reason.derived = False
def update_needrun(job):
    reason = self.reason(job)
    noinitreason = (not reason)
    updated_subworkflow_input = self.updated_subworkflow_files.intersection(job.input)
    if (((job not in self.omitforce) and (job.rule in self.forcerules)) or (not self.forcefiles.isdisjoint(job.output))):
        reason.forced = True
    elif updated_subworkflow_input:
        reason.updated_input.update(updated_subworkflow_input)
    elif (job in self.targetjobs):
        if ((not job.output) and (not job.benchmark)):
            if job.input:
                if job.rule.norun:
                    reason.updated_input_run.update([f for f in job.input if (not f.exists)])
                else:
                    reason.nooutput = True
            else:
                reason.noio = True
        else:
            if (job.rule in self.targetrules):
                missing_output = job.missing_output()
            else:
                missing_output = job.missing_output(requested=(set(chain(*self.depending[job].values())) | self.targetfiles))
            reason.missing_output.update(missing_output)
    if (not reason):
        output_mintime_ = output_mintime.get(job)
        if output_mintime_:
            updated_input = [f for f in job.input if (f.exists and f.is_newer(output_mintime_))]
            reason.updated_input.update(updated_input)
    if (noinitreason and reason):
        reason.derived = False