talna-evogene opened a new issue #20442:
URL: https://github.com/apache/airflow/issues/20442


   ### Apache Airflow version
   
   2.2.2 (latest released)
   
   ### What happened
   
   Hi
   We upgraded to version 2.2.2 and starting getting errors in the UI when we 
have DAG params that are numeric (tried with types 'number', 'integer' and 
'float' and got the same error.
   
   `Python version: 3.7.12
   Airflow version: 2.2.2
   Node: airflow2-webserver-6df5fc45bd-5vdhs
   
-------------------------------------------------------------------------------
   Traceback (most recent call last):
     File 
"/home/airflow/.local/lib/python3.7/site-packages/airflow/models/param.py", 
line 61, in __init__
       jsonschema.validate(self.value, self.schema, 
format_checker=FormatChecker())
     File 
"/home/airflow/.local/lib/python3.7/site-packages/jsonschema/validators.py", 
line 934, in validate
       raise error
   jsonschema.exceptions.ValidationError: 'NoValueSentinel' is not of type 
'number'
   
   Failed validating 'type' in schema:
       {'type': 'number'}
   
   On instance:
       'NoValueSentinel'
   
   During handling of the above exception, another exception occurred:
   
   Traceback (most recent call last):
     File "/home/airflow/.local/lib/python3.7/site-packages/flask/app.py", line 
2447, in wsgi_app
       response = self.full_dispatch_request()
     File "/home/airflow/.local/lib/python3.7/site-packages/flask/app.py", line 
1952, in full_dispatch_request
       rv = self.handle_user_exception(e)
     File "/home/airflow/.local/lib/python3.7/site-packages/flask/app.py", line 
1821, in handle_user_exception
       reraise(exc_type, exc_value, tb)
     File "/home/airflow/.local/lib/python3.7/site-packages/flask/_compat.py", 
line 39, in reraise
       raise value
     File "/home/airflow/.local/lib/python3.7/site-packages/flask/app.py", line 
1950, in full_dispatch_request
       rv = self.dispatch_request()
     File "/home/airflow/.local/lib/python3.7/site-packages/flask/app.py", line 
1936, in dispatch_request
       return self.view_functions[rule.endpoint](**req.view_args)
     File 
"/home/airflow/.local/lib/python3.7/site-packages/airflow/www/auth.py", line 
51, in decorated
       return func(*args, **kwargs)
     File 
"/home/airflow/.local/lib/python3.7/site-packages/airflow/www/decorators.py", 
line 109, in view_func
       return f(*args, **kwargs)
     File 
"/home/airflow/.local/lib/python3.7/site-packages/airflow/www/decorators.py", 
line 72, in wrapper
       return f(*args, **kwargs)
     File 
"/home/airflow/.local/lib/python3.7/site-packages/airflow/utils/session.py", 
line 70, in wrapper
       return func(*args, session=session, **kwargs)
     File 
"/home/airflow/.local/lib/python3.7/site-packages/airflow/www/views.py", line 
2426, in graph
       dag = current_app.dag_bag.get_dag(dag_id)
     File 
"/home/airflow/.local/lib/python3.7/site-packages/airflow/utils/session.py", 
line 70, in wrapper
       return func(*args, session=session, **kwargs)
     File 
"/home/airflow/.local/lib/python3.7/site-packages/airflow/models/dagbag.py", 
line 186, in get_dag
       self._add_dag_from_db(dag_id=dag_id, session=session)
     File 
"/home/airflow/.local/lib/python3.7/site-packages/airflow/models/dagbag.py", 
line 261, in _add_dag_from_db
       dag = row.dag
     File 
"/home/airflow/.local/lib/python3.7/site-packages/airflow/models/serialized_dag.py",
 line 180, in dag
       dag = SerializedDAG.from_dict(self.data)  # type: Any
     File 
"/home/airflow/.local/lib/python3.7/site-packages/airflow/serialization/serialized_objects.py",
 line 947, in from_dict
       return cls.deserialize_dag(serialized_obj['dag'])
     File 
"/home/airflow/.local/lib/python3.7/site-packages/airflow/serialization/serialized_objects.py",
 line 861, in deserialize_dag
       v = {task["task_id"]: SerializedBaseOperator.deserialize_operator(task) 
for task in v}
     File 
"/home/airflow/.local/lib/python3.7/site-packages/airflow/serialization/serialized_objects.py",
 line 861, in <dictcomp>
       v = {task["task_id"]: SerializedBaseOperator.deserialize_operator(task) 
for task in v}
     File 
"/home/airflow/.local/lib/python3.7/site-packages/airflow/serialization/serialized_objects.py",
 line 641, in deserialize_operator
       v = cls._deserialize_params_dict(v)
     File 
"/home/airflow/.local/lib/python3.7/site-packages/airflow/serialization/serialized_objects.py",
 line 459, in _deserialize_params_dict
       op_params[k] = cls._deserialize_param(v)
     File 
"/home/airflow/.local/lib/python3.7/site-packages/airflow/serialization/serialized_objects.py",
 line 439, in _deserialize_param
       return class_(**kwargs)
     File 
"/home/airflow/.local/lib/python3.7/site-packages/airflow/models/param.py", 
line 63, in __init__
       raise ValueError(err)
   ValueError: 'NoValueSentinel' is not of type 'number'
   
   Failed validating 'type' in schema:
       {'type': 'number'}
   
   On instance:
       'NoValueSentinel'`
   
   ### What you expected to happen
   
   shouldn't cause a serialization error. 
   
   ### How to reproduce
   
   This is a small DAG to reproduce this error. 
   We use airflow on kubernetes with:
   Python version: 3.7.12
   Airflow version: 2.2.2
   
   `from airflow import DAG
   from airflow.models.param import Param
   from airflow.operators.dummy import DummyOperator
   from datetime import datetime
   params = {
       'wd': Param(type='number', description="demo numeric param")
   }
   default_args ={
       'depends_on_past': False,
       'start_date': datetime(2021, 6, 16)
   }
   with DAG 
('mydag',params=params,default_args=default_args,catchup=False,schedule_interval=None)
 as dag:
       t1 = DummyOperator(task_id='task1')
   `
   
   ### Operating System
   
   centos
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Official Apache Airflow Helm Chart
   
   ### Deployment details
   
   _No response_
   
   ### Anything else
   
   On every dag with a numeric type of param
   
   ### 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]


Reply via email to