<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def mark_parent_tasks_as_failed(self, task_name, flush_logs=False):
 """ Marks all the parent tasks as failed Args: task_name (str):
 Name of the child task flush_logs (bool):
 If ``True`` will discard all the logs form parent tasks Returns: None """

        for existing_task_name in self.tasks:
            if existing_task_name == task_name:
                break

            if flush_logs:
                self.tasks[existing_task_name].clear()

            self.tasks[existing_task_name].failed = True

        self.mark_main_tasks_as_failed()