Comments (17)
yeah, would be great to avoid DB internal error
Feel free to fix it. Apache Airflow it is open source project, and every one could contribute changes (fixes/features) back, especially if they know what then outcome achievement/benefits of the changes.
So I would recommend try to patch this part into your side and check is it still work as expected, and without additional error logs in DB backend and without side effects.
diff --git a/airflow/models/taskinstance.py b/airflow/models/taskinstance.py
index f154461a77..a08b9cd94a 100644
--- a/airflow/models/taskinstance.py
+++ b/airflow/models/taskinstance.py
@@ -3454,8 +3454,12 @@ class TaskInstance(Base, LoggingMixin):
run_id=ti.run_id,
),
session=session,
- nowait=True,
- ).one()
+ skip_locked=True,
+ ).one_or_none()
+ if not dag_run:
+ # Need to log something?
+ session.rollback()
+ return
task = ti.task
if TYPE_CHECKING:
from airflow.
thanks @Taragolis, I will try with my first PR)
from airflow.
I tested the image from PR on our environment and this error disappeared.
from airflow.
Correction: SELECT .. FOR UPDATE NOWAIT
raise this error
from airflow.
This one use in mini scheduler mechanism, which might fail and it is fine and by design, this just an optimisation mechanism.
It might also tried to work concurrently, so the idea (as I could understand) it try to obtain row lock level lock and if it failed (EAFP) than it fine because other mini-scheduler already care about it.
from airflow.
As measure might be use skip_locked
instead of no_wait
both of them non blocking, with differences how it handled internally in DB backend:
- SKIP LOCKED: return non locked records
- NO WAIT: raise an error
from airflow.
I've added couple additional reviewers which might more familiar with the mini scheduler. But it might take a time - all review happen by people on their free time, and some reviews require a bit more time that others.
You could also ask a round in #new-contributors
or #contributors
(pick one channel) in Apache Airflow Community Slack Workspace
from airflow.
Does #39745 solves this issue or are there additional tasks?
It does, we can close it.
from airflow.
The Postgres instance started reporting many could not obtain lock on row in relation "dag_run" errors:
This pretty fine, because Airflow tried to obtain row level lock by utilise statement SELECT .. FOR UPDATE SKIP LOCKED
from airflow.
But it seems what has been added in #38914. I'm not sure that ignoring this error can be considered a solution. If it always results in an ERROR when trying to obtain a lock, why do we even need to attempt the query?
from airflow.
if it always results in an ERROR
Are you sure that it is always return an error?
from airflow.
I'm not sure. But then should be kind of retry mechanism(I'm also not sure if we have it). Anyway I just see a lot of errors in DB and my first guess: something is not correct with transaction level.
from airflow.
As measure might be use
skip_locked
instead ofno_wait
both of them non blocking, with differences how it handled internally in DB backend:
- SKIP LOCKED: return non locked records
- NO WAIT: raise an error
yeah, would be great to avoid DB internal error
from airflow.
@VladimirYushkevich thanks for the PR, I am seeing the same errors since updating to 2.9.1
when running mapped tasks on a LocalExecutor
.
from airflow.
@Taragolis, do I need to ask for the review explicitly? I believe the PR is ready from my side, but maybe I'm missing something.
from airflow.
Does #39745 solves this issue or are there additional tasks?
from airflow.
related
from airflow.
Related Issues (20)
- OTEL metrics are setting service.name as attributes, where it should be set as resource attributes HOT 1
- Getting error when `retries` is set to None at task level HOT 3
- remove pickle_id column (and other related stuff?)
- Status of testing of Apache Airflow 2.10.2rc1 HOT 5
- kubectl token invalid when airflow debug mode enabled HOT 1
- DAG Bundle Backend Interface
- Create Local DAG bundle backend
- Create git DAG bundle backend
- Modify DagBag/Parsing loop to be DAG bundle backend aware
- Modify task runtime to use DAG bundle backends
- DB changes to track DAG bundle versions
- Add model for configuring DAG bundle backends
- Add cli for configuring DAG bundle backends
- Add REST API for configuring DAG bundle backends
- Add UI for configuring DAG bundle backends
- Harden DAG Bundle backends
- Add support for manifest files in DAG bundles
- Support configuring bundle parsing interval
- Determine what interval control options we need from manifest file
- Changed behaviour on macros template due to Pendulum v3 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from airflow.