hussein-awala commented on code in PR #28777: URL: https://github.com/apache/airflow/pull/28777#discussion_r1064216151
########## airflow/www/utils.py: ########## @@ -133,13 +133,25 @@ def get_mapped_summary(parent_instance, task_instances): def get_dag_run_conf(dag_run_conf: Any) -> tuple[str | None, bool]: + class DagRunConfEncoder(json.JSONEncoder): + def default(self, obj): + if isinstance(obj, bytes): + try: + return obj.decode() + except Exception: + return str(obj) + try: + return json.JSONEncoder.default(self, obj) + except Exception: + return str(obj) Review Comment: Actually It's possible using the Airflow python API (the method [DAG.create_dagrun](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/models/dag/index.html#airflow.models.dag.DAG.create_dagrun)): ```python dag_bag = DagBag(read_dags_from_db=True) dag_bag.collect_dags_from_db() dag = dag_bag.get_dag("dag_id") dag.create_dagrun( run_id="run_id", run_type=DagRunType.MANUAL, execution_date=run_start_date, state=State.QUEUED, external_trigger=True, data_interval=(run_start_date, run_end_date), conf = {<str key>: <any value>} ) ``` And we use this method frequently in the [custom plugins](https://airflow.apache.org/docs/apache-airflow/stable/plugins.html). This part is public and documented. Also we can update the run conf from a task, and the updated fields are accessible from the other tasks ([ex](https://github.com/apache/airflow/issues/28772)) -- 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]
