FrankYang0529 commented on code in PR #73767:
URL: https://github.com/apache/airflow/pull/73767#discussion_r4117642816
##########
go-sdk/airflow/bundle.go:
##########
@@ -138,3 +149,23 @@ func (m *taskHandlerMap) ListTaskHandlers()
[]bundle.TaskHandlerInfo {
return slices.Clone(m.order)
}
+
+// dagMap holds the registered Dags by dag_id.
+type dagMap struct {
+ mu sync.Mutex
+ dags map[string]*DagRef
+}
+
+func (m *dagMap) add(dag *DagRef) {
+ m.mu.Lock()
+ defer m.mu.Unlock()
+
+ if _, exists := m.dags[dag.dagId]; exists {
+ panic(fmt.Sprintf("airflow.BundleRef.Register: Dag %q is
already registered", dag.dagId))
Review Comment:
Agreed, I'll do it in a follow-up.
##########
go-sdk/airflow/spec.go:
##########
@@ -0,0 +1,28 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package airflow
+
+// DagSpec holds the attributes of a Dag other than its dag_id. [Dag] takes
one.
+type DagSpec struct{}
+
+// TaskSpec holds the attributes of a task. [DagRef.Task] takes at most one
per task.
+type TaskSpec struct {
+ // TaskID is the task_id of the task. When TaskID is empty, the task_id
is the name of the
+ // Go function that the task runs.
+ TaskID string
Review Comment:
Yes. It follows Go's rule for initialisms, which asks for `appID` rather
than `appId`: https://go.dev/wiki/CodeReviewComments#initialisms.
--
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]