def check_upstream_trigger(self) -> bool:
if self.operation.trigger_policy == TriggerPolicy.ONE_DONE:<EOL><INDENT>return self.upstream_runs.filter(<EOL>status__status__in=self.STATUSES.DONE_STATUS).exists()<EOL><DEDENT>if self.operation.trigger_policy == TriggerPolicy.ONE_SUCCEEDED:<EOL><INDENT>return self.upstream_runs.filter(<EOL>status__status=self.STATUSES.SUCCEEDED).exists()<EOL><DEDENT>if self.operation.trigger_policy == TriggerPolicy.ONE_FAILED:<EOL><INDENT>return self.upstream_runs.filter(<EOL>status__status=self.STATUSES.FAILED).exists()<EOL><DEDENT>statuses = self.upstream_runs.values_list('<STR_LIT>', flat=True)<EOL>if self.operation.trigger_policy == TriggerPolicy.ALL_DONE:<EOL><INDENT>return not bool([True for status in statuses<EOL>if status not in self.STATUSES.DONE_STATUS])<EOL><DEDENT>if self.operation.trigger_policy == TriggerPolicy.ALL_SUCCEEDED:<EOL><INDENT>return not bool([True for status in statuses<EOL>if status != self.STATUSES.SUCCEEDED])<EOL><DEDENT>if self.operation.trigger_policy == TriggerPolicy.ALL_FAILED:<EOL><INDENT>return not bool([True for status in statuses<EOL>if status not in self.STATUSES.FAILED_STATUS])<EOL><DEDENT>
Checks the upstream and the trigger rule.