dKosarevsky opened a new issue, #25576:
URL: https://github.com/apache/airflow/issues/25576
### Apache Airflow version
2.3.3
### What happened
Try to run task from code and get error:
```py
Traceback (most recent call last):
File
"/home/airflow/.local/lib/python3.10/site-packages/airflow/operators/python.py",
line 171, in execute
return_value = self.execute_callable()
File
"/home/airflow/.local/lib/python3.10/site-packages/airflow/operators/python.py",
line 189, in execute_callable
return self.python_callable(*self.op_args, **self.op_kwargs)
File
"/home/airflow/.local/lib/python3.10/site-packages/airflow/utils/session.py",
line 71, in wrapper
return func(*args, session=session, **kwargs)
File
"/opt/airflow/dags/repo/dags/pik_digital/pik_dags/_queued_tasks_runner/__init__.py",
line 39, in run_queued_tasks
ti.dry_run()
File
"/home/airflow/.local/lib/python3.10/site-packages/airflow/models/taskinstance.py",
line 1820, in dry_run
self.task = self.task.prepare_for_execution()
AttributeError: 'TaskInstance' object has no attribute 'task'
```
### What you think should happen instead
Instead of error task should run. I think it chained with [Hide some task
instance attributes in details page
#23338](https://github.com/apache/airflow/pull/23338)
### How to reproduce
```py
@provide_session
def run_queued_tasks(session):
filter_ = [
or_(TaskInstance.state == State.QUEUED, TaskInstance.state ==
State.NONE),
TaskInstance.queued_dttm < datetime.now(timezone.utc) -
timedelta(minutes=20)
]
tis = session.query(TaskInstance).filter(*filter_).all()
if not len(tis):
raise AirflowSkipException("Skipped. Empty task instances list.")
logger.info(f"Updating {len(tis)} task instances:")
for ti in tis:
logger.info(dict(
dag_id=ti.dag_id,
task_id=ti.task_id,
state=ti.state,
execution_date=ti.execution_date,
))
ti.run(session=session)
session.commit()
logger.info("Done.")
```
### Operating System
Debian GNU/Linux 11 (bullseye)
### Versions of Apache Airflow Providers
apache-airflow-providers-amazon==4.0.0
apache-airflow-providers-celery==3.0.0
apache-airflow-providers-cncf-kubernetes==4.1.0
apache-airflow-providers-common-sql==1.0.0
apache-airflow-providers-docker==3.0.0
apache-airflow-providers-elasticsearch==4.0.0
apache-airflow-providers-ftp==3.0.0
apache-airflow-providers-google==8.1.0
apache-airflow-providers-grpc==3.0.0
apache-airflow-providers-hashicorp==3.0.0
apache-airflow-providers-http==3.0.0
apache-airflow-providers-imap==3.0.0
apache-airflow-providers-microsoft-azure==4.0.0
apache-airflow-providers-microsoft-mssql==3.1.0
apache-airflow-providers-mysql==3.0.0
apache-airflow-providers-odbc==3.0.0
apache-airflow-providers-postgres==5.0.0
apache-airflow-providers-redis==3.0.0
apache-airflow-providers-sendgrid==3.0.0
apache-airflow-providers-sftp==3.0.0
apache-airflow-providers-slack==5.0.0
apache-airflow-providers-sqlite==3.0.0
apache-airflow-providers-ssh==3.0.0
apache-airflow-providers-telegram==3.0.0
apache-airflow-providers-vertica==3.1.0
### Deployment
Official Apache Airflow Helm Chart
### Deployment details
terraform, helm, k8s, cloud
### Anything else
_No response_
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [X] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]