with dag_maker():
        @setup
        def setuptask():
            print(2)
        @teardown
        def teardown_task():
            print(1)
        @task
        def mytask():
            print(1)
        setuptask()
        teardown_task()
        mytask()
    dr = dag_maker.create_dagrun()
    s1 = dr.get_task_instance(task_id="setuptask")
    td1 = dr.get_task_instance(task_id="teardown_task")
    t1 = dr.get_task_instance(task_id="mytask")
    s1.state = TaskInstanceState.SUCCESS
    td1.state = TaskInstanceState.SUCCESS
    t1.state = TaskInstanceState.FAILED
    session.merge(s1)
    session.merge(td1)
    session.merge(t1)
    session.flush()