xawyong opened a new issue #13507: URL: https://github.com/apache/airflow/issues/13507
<!-- Welcome to Apache Airflow! For a smooth issue process, try to answer the following questions. Don't worry if they're not all applicable; just try to include what you can :-) If you need to include code snippets or logs, please put them in fenced code blocks. If they're super-long, please use the details tag like <details><summary>super-long log</summary> lots of stuff </details> Please delete these comment blocks before submitting the issue. --> <!-- IMPORTANT!!! PLEASE CHECK "SIMILAR TO X EXISTING ISSUES" OPTION IF VISIBLE NEXT TO "SUBMIT NEW ISSUE" BUTTON!!! PLEASE CHECK IF THIS ISSUE HAS BEEN REPORTED PREVIOUSLY USING SEARCH!!! Please complete the next sections or the issue will be closed. These questions are the first thing we need to know to understand the context. --> **Apache Airflow version**: ``` [root@test ~]# airflow version 2.0.0 [root@test ~]# airflow config get-value core executor SequentialExecutor [root@test ~]# ``` **Kubernetes version (if you are using kubernetes)** (use `kubectl version`): N/A **Environment**: ``` [root@test ~]# uname -a Linux test 3.10.0-1160.11.1.el7.x86_64 #1 SMP Mon Nov 30 13:05:31 EST 2020 x86_64 x86_64 x86_64 GNU/Linux [root@test ~]# cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.9 (Maipo) [root@test ~]# cat /etc/os-release NAME="Red Hat Enterprise Linux Server" VERSION="7.9 (Maipo)" ID="rhel" ID_LIKE="fedora" VARIANT="Server" VARIANT_ID="server" VERSION_ID="7.9" PRETTY_NAME="Red Hat Enterprise Linux Server 7.9 (Maipo)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:redhat:enterprise_linux:7.9:GA:server" HOME_URL="https://www.redhat.com/" BUG_REPORT_URL="https://bugzilla.redhat.com/" REDHAT_BUGZILLA_PRODUCT="Red Hat Enterprise Linux 7" REDHAT_BUGZILLA_PRODUCT_VERSION=7.9 REDHAT_SUPPORT_PRODUCT="Red Hat Enterprise Linux" REDHAT_SUPPORT_PRODUCT_VERSION="7.9" [root@test ~]# ``` - **Cloud provider or hardware configuration**: - **OS** (e.g. from /etc/os-release): - **Kernel** (e.g. `uname -a`): - **Install tools**: - **Others**: **What happened**: just follow [quick start](https://airflow.apache.org/docs/apache-airflow/stable/start.html), and config ``` executor = DaskExecutor and sql_alchemy_conn = postgresql://postgres:postgres@localhost:5432/airflow ``` then run ``` airflow db init airflow db reset airflow webserver -D [root@test ~]# airflow scheduler ____________ _____________ ____ |__( )_________ __/__ /________ __ ____ /| |_ /__ ___/_ /_ __ /_ __ \_ | /| / / ___ ___ | / _ / _ __/ _ / / /_/ /_ |/ |/ / _/_/ |_/_/ /_/ /_/ /_/ \____/____/|__/ [2021-01-06 03:58:31,138] {scheduler_job.py:1241} INFO - Starting the scheduler [2021-01-06 03:58:31,139] {scheduler_job.py:1246} INFO - Processing each file at most -1 times /usr/local/lib/python3.7/site-packages/distributed/client.py:1128 VersionMismatchWarning: Mismatched versions found +-------------+-----------+-----------------------+-----------------------+ | Package | client | scheduler | workers | +-------------+-----------+-----------------------+-----------------------+ | distributed | 2020.12.0 | 2020.12.0+11.g4386b75 | 2020.12.0+11.g4386b75 | +-------------+-----------+-----------------------+-----------------------+ [2021-01-06 03:58:31,195] {dag_processing.py:250} INFO - Launched DagFileProcessorManager with pid: 16318 [2021-01-06 03:58:31,197] {scheduler_job.py:1751} INFO - Resetting orphaned tasks for active dag runs [2021-01-06 03:58:31,203] {settings.py:52} INFO - Configured default timezone Timezone('UTC') [2021-01-06 03:58:31,227] {scheduler_job.py:1293} ERROR - Exception when executing SchedulerJob._run_scheduler_loop Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1277, in _execute_context cursor, statement, parameters, context File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 593, in do_execute cursor.execute(statement, parameters) psycopg2.errors.SyntaxError: syntax error at or near "SKIP" LINE 3: ...run.state = 'running' FOR UPDATE OF task_instance SKIP LOCKE... ^ The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/airflow/jobs/scheduler_job.py", line 1275, in _execute self._run_scheduler_loop() File "/usr/local/lib/python3.7/site-packages/airflow/jobs/scheduler_job.py", line 1349, in _run_scheduler_loop self.adopt_or_reset_orphaned_tasks() File "/usr/local/lib/python3.7/site-packages/airflow/utils/session.py", line 65, in wrapper return func(*args, session=session, **kwargs) File "/usr/local/lib/python3.7/site-packages/airflow/jobs/scheduler_job.py", line 1787, in adopt_or_reset_orphaned_tasks tis_to_reset_or_adopt = with_row_locks(query, of=TI, **skip_locked(session=session)).all() File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3373, in all return list(self) File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3535, in __iter__ return self._execute_and_instances(context) File "/usr/local/lib/python3.7/site-packages/sqlalchemy/orm/query.py", line 3560, in _execute_and_instances result = conn.execute(querycontext.statement, self._params) File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1011, in execute return meth(self, multiparams, params) File "/usr/local/lib/python3.7/site-packages/sqlalchemy/sql/elements.py", line 298, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1130, in _execute_clauseelement distilled_params, File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1317, in _execute_context e, statement, parameters, cursor, context File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1511, in _handle_dbapi_exception sqlalchemy_exception, with_traceback=exc_info[2], from_=e File "/usr/local/lib/python3.7/site-packages/sqlalchemy/util/compat.py", line 182, in raise_ raise exception File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/base.py", line 1277, in _execute_context cursor, statement, parameters, context File "/usr/local/lib/python3.7/site-packages/sqlalchemy/engine/default.py", line 593, in do_execute cursor.execute(statement, parameters) sqlalchemy.exc.ProgrammingError: (psycopg2.errors.SyntaxError) syntax error at or near "SKIP" LINE 3: ...run.state = 'running' FOR UPDATE OF task_instance SKIP LOCKE... ^ [SQL: SELECT task_instance.task_id AS task_instance_task_id, task_instance.dag_id AS task_instance_dag_id, task_instance.execution_date AS task_instance_execution_date FROM task_instance LEFT OUTER JOIN job ON task_instance.queued_by_job_id = job.id JOIN dag_run ON task_instance.dag_id = dag_run.dag_id AND task_instance.execution_date = dag_run.execution_date WHERE task_instance.state IN (%(state_1)s, %(state_2)s, %(state_3)s) AND (task_instance.queued_by_job_id IS NULL OR job.state != %(state_4)s) AND dag_run.run_type != %(run_type_1)s AND dag_run.state = %(state_5)s FOR UPDATE OF task_instance SKIP LOCKED] [parameters: {'state_1': 'scheduled', 'state_2': 'queued', 'state_3': 'running', 'state_4': 'running', 'run_type_1': <DagRunType.BACKFILL_JOB: 'backfill'>, 'state_5': 'running'}] (Background on this error at: http://sqlalche.me/e/13/f405) [2021-01-06 03:58:32,243] {process_utils.py:95} INFO - Sending Signals.SIGTERM to GPID 16318 [2021-01-06 03:58:32,448] {process_utils.py:201} INFO - Waiting up to 5 seconds for processes to exit... [2021-01-06 03:58:32,465] {process_utils.py:61} INFO - Process psutil.Process(pid=16318, status='terminated', exitcode=0, started='03:58:30') (16318) terminated with exit code 0 [2021-01-06 03:58:32,466] {process_utils.py:61} INFO - Process psutil.Process(pid=16368, status='terminated', started='03:58:31') (16368) terminated with exit code None [2021-01-06 03:58:32,466] {process_utils.py:61} INFO - Process psutil.Process(pid=16369, status='terminated', started='03:58:31') (16369) terminated with exit code None [2021-01-06 03:58:32,467] {scheduler_job.py:1296} INFO - Exited execute loop [root@test ~]# ``` <!-- (please include exact error messages if you can) --> **What you expected to happen**: <!-- What do you think went wrong? --> **How to reproduce it**: <!--- As minimally and precisely as possible. Keep in mind we do not have access to your cluster or dags. If you are using kubernetes, please attempt to recreate the issue using minikube or kind. ## Install minikube/kind - Minikube https://minikube.sigs.k8s.io/docs/start/ - Kind https://kind.sigs.k8s.io/docs/user/quick-start/ If this is a UI bug, please provide a screenshot of the bug or a link to a youtube video of the bug in action You can include images using the .md style of  To record a screencast, mac users can use QuickTime and then create an unlisted youtube video with the resulting .mov file. ---> **Anything else we need to know**: <!-- How often does this problem occur? Once? Every time etc? Any relevant logs to include? Put them here in side a detail tag: <details><summary>x.log</summary> lots of stuff </details> --> ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
