stuart23 commented on code in PR #54702:
URL: https://github.com/apache/airflow/pull/54702#discussion_r2317140974


##########
airflow-core/src/airflow/cli/commands/dag_command.py:
##########
@@ -648,6 +649,140 @@ def dag_test(args, dag: DAG | None = None, session: 
Session = NEW_SESSION) -> No
         raise SystemExit("DagRun failed")
 
 
+def _get_schedule_info(dag: DAG) -> str | None:
+    """Extract and format schedule information from a Dag."""
+    try:
+        # Try to get schedule from different possible attributes
+        schedule = getattr(dag, 'schedule', None) or getattr(dag, 
'schedule_interval', None)
+        
+        if schedule is None:
+            return "Manual (no schedule)"
+        
+        # Handle different schedule types
+        if isinstance(schedule, str):
+            # Cron expressions or preset schedules
+            # Preset schedules like @daily, @hourly
+            preset_map = {
+                '@once': 'Once',
+                '@hourly': 'Hourly (0 * * * *)',
+                '@daily': 'Daily (0 0 * * *)',
+                '@weekly': 'Weekly (0 0 * * 0)',
+                '@monthly': 'Monthly (0 0 1 * *)',
+                '@yearly': 'Yearly (0 0 1 1 *)',
+                '@annually': 'Annually (0 0 1 1 *)',
+            }

Review Comment:
   Is this better? 
https://github.com/apache/airflow/pull/54702/files#diff-b28357c8748ec828697a10b2d785bffea845397916d410da18e0265b54155867R692-R697



-- 
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