jason810496 commented on code in PR #75503:
URL: https://github.com/apache/airflow/pull/75503#discussion_r4409584898
##########
airflow-core/src/airflow/dag_processing/processor.py:
##########
@@ -117,9 +119,28 @@ class DagFileParseRequest(BaseModel):
"""Bundle name for team-specific executor validation."""
callback_requests: list[CallbackRequest] = Field(default_factory=list)
+
+ create_cron_data_intervals: bool = False
+ """``[scheduler] create_cron_data_intervals``.
+
+ A bundle cannot read the Airflow configuration, so the Dag processor sends
the option with the
+ parse request, and the runtime builds the timetable that Python's
``_create_timetable``
+ builds from the same schedule.
+ """
+
+ dag_default_timezone: str | int = "UTC"
+ """Encoded ``[core] default_timezone`` for a Dag without a
``start_date``."""
Review Comment:
Additionally, I'd like to have nested model as container for all the config
(since there might be more we need to handle) in the new dedicated
`DagFileParseRequest`.
##########
airflow-core/src/airflow/dag_processing/processor.py:
##########
@@ -117,9 +119,28 @@ class DagFileParseRequest(BaseModel):
"""Bundle name for team-specific executor validation."""
callback_requests: list[CallbackRequest] = Field(default_factory=list)
+
+ create_cron_data_intervals: bool = False
+ """``[scheduler] create_cron_data_intervals``.
+
+ A bundle cannot read the Airflow configuration, so the Dag processor sends
the option with the
+ parse request, and the runtime builds the timetable that Python's
``_create_timetable``
+ builds from the same schedule.
+ """
+
+ dag_default_timezone: str | int = "UTC"
+ """Encoded ``[core] default_timezone`` for a Dag without a
``start_date``."""
Review Comment:
Let's also note down what is the str and int means.
##########
airflow-core/src/airflow/dag_processing/lang_sdk_processor.py:
##########
@@ -194,7 +195,10 @@ def start( # type: ignore[override]
for listener in listeners.values():
listener.setblocking(False)
parse_request = DagFileParseRequest(
Review Comment:
I think we should have a dedicated subclass for lang SDK only
`DagFileParseRequest`.
##########
go-sdk/pkg/execution/genmodels/defaults.gen.go:
##########
@@ -79,6 +79,30 @@ func (m *DagCallbackRequest) DecodeMsgpack(dec
*msgpack.Decoder) error {
return nil
}
+// DecodeMsgpack applies DagFileParseRequest's schema defaults that msgpack
would otherwise skip.
+func (m *DagFileParseRequest) DecodeMsgpack(dec *msgpack.Decoder) error {
+ type alias DagFileParseRequest
+ v := alias{}
+ // Decode once into raw bytes so a nullable default applies only on an
absent
+ // wire key, never overwriting an explicit null (both decode to nil).
+ var raw msgpack.RawMessage
+ if err := dec.Decode(&raw); err != nil {
+ return err
+ }
+ if err := msgpack.Unmarshal(raw, &v); err != nil {
+ return err
+ }
+ var present map[string]msgpack.RawMessage
+ if err := msgpack.Unmarshal(raw, &present); err != nil {
+ return err
+ }
+ if _, ok := present["dag_default_timezone"]; !ok {
+ v.DagDefaultTimezone = "UTC"
+ }
Review Comment:
We shouldn't set default on the SDK runtime side anymore since the core side
should handle this.
--
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]