question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't override attributes on task_policy on 2.4

See original GitHub issue

Apache Airflow version

2.4.0

What happened

Task policies on airflow 2.4 are raising ERROR [airflow.models.dagbag.DagBag] can't set attribute error on trying to override the values.

What you think should happen instead

No response

How to reproduce

Override an attribute using task_policy on config/airflow_local_settings.py using the docker image apache/airflow:slim-2.4.0-python3.10

def task_policy(task):
    task.owner = "newowner"
    task.on_failure_callback = lambda context: print(context)

Operating System

docker image apache/airflow:slim-2.4.0-python3.10

Versions of Apache Airflow Providers

No response

Deployment

Other Docker-based deployment

Deployment details

No response

Anything else

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

3reactions
dima-lyublincommented, Nov 3, 2022

I have a similar issue in Airflow 2.4.2:

def create_hooks(self):
     self.s3_hook = S3Hook(aws_conn_id=self.s3_conn_id)
     self.s3_hook.extra_args = {"ContentType": content_type}
ERROR - Task failed with exception
Traceback (most recent call last):
  File "", line 57, in execute
    self.s3_hook.extra_args = {"ContentType": content_type}
AttributeError: can't set attribute
0reactions
potiukcommented, Nov 7, 2022

@mariotaddeucci -> any news ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to override chef-attributes
I am running the below command in powershell to perform chef operations. chef-client -o 'recipe[cookbook]' -j attributes-file.json. Contents of ...
Read more >
Pass override attribute via command line for chef-solo
You can use the -j command line option in order to define attributes you may want to override the default ones.
Read more >
Cluster Policies — Airflow Documentation
Any extra attributes set by a cluster policy take priority over those ... If you want to override the default operator settings, use...
Read more >
5 Handling Information in Your Process Design
You can access these activity instance attributes in the same way you access regular data objects, but you cannot assign them new values....
Read more >
numa_memory_policy.rst
If a task does not define a task policy, then all page allocations that ... However, unlike VMA policies, which can be considered...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found