amoghrajesh commented on code in PR #54505:
URL: https://github.com/apache/airflow/pull/54505#discussion_r2558897377
##########
task-sdk/src/airflow/sdk/definitions/operator_resources.py:
##########
@@ -41,7 +40,7 @@ class Resource:
def __init__(self, name, units_str, qty):
if qty < 0:
- raise AirflowException(
+ raise ValueError(
Review Comment:
Since this one is public facing too, maybe we should consider compat here or
document it well in a newsfragment:
```python
Resource(name="res1", qty=-1, units_str="MB")
Traceback (most recent call last):
File
"/Users/amoghdesai/Documents/OSS/repos/airflow/.venv/lib/python3.13/site-packages/IPython/core/interactiveshell.py",
line 3699, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<ipython-input-6-eef0e426632d>", line 1, in <module>
Resource(name="res1", qty=-1, units_str="MB")
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File
"/Users/amoghdesai/Documents/OSS/repos/airflow/task-sdk/src/airflow/sdk/definitions/operator_resources.py",
line 43, in __init__
raise ValueError(
...<2 lines>...
)
ValueError: Received resource quantity -1 for resource res1, but resource
quantity must be non-negative.
```
Earlier it would have been AirflowException
--
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]