Airflow Debug throws "(sqlite3.OperationalError) no such table: task_instance" when debugging remote from VScode

Viewed 449

First of all, I'm using VScode and airflow 2.0.1 is on a remote server, thus im ssh'ing onto the server. All the files are on the remote server.

In my dag.py I have

from airflow import DAG
from airflow.utils.dates import days_ago
from datetime import timedelta
from airflow.operators.python import PythonVirtualenvOperator

default_args = {
    'owner': 'me',
    'depends_on_past': False,
}

with DAG(
    'test',
    default_args=default_args,
    description='Test ',
    schedule_interval=timedelta(days=1),
    start_date=days_ago(1),
) as dag:


    t1 = PythonVirtualenvOperator(
        task_id = "test1",
        python_version = "3.7",
        python_callable = test1,
        requirements = req
    )

    t2 = PythonVirtualenvOperator(
        task_id = "test2",
        python_version = "3.7",
        python_callable = test2,
        requirements = req
    )


    t1>>t2

if __name__=="__main__":
    from airflow.utils.state import State
    dag.clear(dag_run_state=State.NONE)
    dag.run()

and my launch.json in vscode

{    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Current File",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal",
            "env":{
                "AIRFLOW__CORE__EXECUTOR":"DebugExecutor"
            }
        }
    ]
}

When I then enter dag.py and pressed the debug, it stops on dag.clear(dag_run_state=State.NONE) and throws (sqlite3.OperationalError) no such table: task_instance".

If I run airflow db check I get

[user]$ airflow db check
[2021-05-26 14:15:35,741] {cli_action_loggers.py:105} WARNING - Failed to log action with (sqlite3.OperationalError) no such table: log
[SQL: INSERT INTO log (dttm, dag_id, task_id, event, execution_date, owner, extra) VALUES (?, ?, ?, ?, ?, ?, ?)]
[parameters: ('2021-05-26 12:15:35.737300', None, None, 'cli_check', None, 'user', '{"host_name": "server", "full_command": "[\'/usr/local/bin/airflow\', \'db\', \'check\']"}')]
(Background on this error at: http://sqlalche.me/e/13/e3q8)
[2021-05-26 14:15:35,746] {db.py:762} INFO - Connection successful.

I'm using SQlite as DB and Airflow runs my DAGS (apart from the one I try to debug) without an issue, so I assume the DB tables are set up correctly?

0 Answers
Related