ephraimbuddy commented on code in PR #52876:
URL: https://github.com/apache/airflow/pull/52876#discussion_r2240781384
##########
airflow-core/src/airflow/dag_processing/bundles/manager.py:
##########
@@ -140,6 +229,35 @@ def sync_bundles_to_db(self, *, session: Session =
NEW_SESSION) -> None:
session.execute(delete(ParseImportError).where(ParseImportError.bundle_name ==
name))
self.log.info("Deleted import errors for bundle %s which is no
longer configured", name)
+ @staticmethod
+ def _extract_template_params(bundle_instance: BaseDagBundle) -> dict:
+ """
+ Extract template parameters from a bundle instance's view_url_template
method.
+
+ :param bundle_instance: The bundle instance to extract parameters from
+ :return: Dictionary of template parameters
+ """
+ import re
+
+ params: dict[str, str] = {}
+ template = bundle_instance.view_url_template()
+
+ if not template:
+ return params
+
+ # Extract template placeholders using regex
+ # This matches {placeholder} patterns in the template
+ placeholder_pattern = r"\{([^}]+)\}"
+ placeholders = re.findall(placeholder_pattern, template)
Review Comment:
@uranusjr what do you think about this use of regex here?
--
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]