def _serialize_params_dict(cls, params: ParamsDict): """Serialize Params dict for a DAG/Task""" serialized_params = {} for k, v in params.items(): # TODO: As of now, we would allow serialization of params which are of type Param only if f'{v.__module__}.{v.__class__.__name__}' == 'airflow.models.param.Param': serialized_params[k] = cls._serialize_param(v) else: raise ValueError('Params to a DAG or a Task can be only of type airflow.models.param.Param') return serialized_params
def _serialize_operator_params(cls, op_params: ParamsDict): """Serialize Params dict of a operator""" serialized_params = {} for k, v in op_params.items(): # TODO: As of now, we would allow serialization of params which are of type Param only if f'{v.__module__}.{v.__class__.__name__}' == 'airflow.models.param.Param': serialized_params[k] = v.dump() else: raise ValueError( 'Params to a Task can be only of type airflow.models.param.Param' ) return serialized_params