Repository navigation
Java SDK: Add edge labels to native Dags - #74523
FrankYang0529 wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Nice, thanks.
I pushed 255a2b1 on top with a few fixes from review:
- Labels are now applied in the order they were set, so the label set last wins, as in Python's
DAG.set_edge_info. Before, a task edge's own label always beat its group edge's label, and relabeling an existing
group edge didn't take effect. - Updated
EdgeLabelTestto match. I checked both cases against Python'sLabel, and theedge_infomatches. - Corrected the KDoc and docs note: Python's
Labelalso changes the edge when one end is in no task group.
|
Python uses the I think we should come up with a better syntax instead just copying Python with |
There was a problem hiding this comment.
I think we should come up with a better syntax instead just copying Python with
>>and<<substituted.
I considered the following syntax before:
loaded.before(reportEmpty, "when empty");
cleaned.after(loaded, "always");However, the wiring should supports fan-in and fan-out.
loaded.before(reportEmpty, "when empty", reportSuspicious, "when suspicious"); // this is not a working syntax to support fan-in.
// the only sutiable way might looks like:
loaded.before([reportEmpty, reportSuspicious], ["when empty", "when suspicious"]);
loaded.before([reportEmpty,"when empty"], [reportSuspicious,, "when suspicious"]); This is why the current syntax goes with current shape, having a dedicated Flow.label wrapper to representing the edge with label:
loaded.before(Flow.label(reportEmpty, "when empty"), Flow.label(reportSuspicious, "when suspicious"));
cleaned.after(Flow.label(loaded, "always"));The Go-SDK went with the same shape already and there was't objection back then.
I don't have a better user interface design at this moment.
Signed-off-by: PoAn Yang <payang@apache.org>
A task edge's own label always won over a group edge's label, and a relabeled group edge kept its first position, so edge_info differed from Python's, where the label set last wins. Also note that Python's Label rewrites an edge when one end is in no task group. Co-Authored-By: Claude <noreply@anthropic.com>
255a2b1 to
ab70317
Compare
|
Thanks for the comments and suggestions. I agree with Jason that Java checks every varargs argument against the same type. A With each label still paired with its node, two changes may make the Java code read better. WDYT?
A bad part is that
|
Deps.Flow.label(flow, text)wraps one end of an edge. Each edge of a fan-out can then carry its own label. Declaring an existing edge again only adds the label to that edge.Was generative AI tooling used to co-author this PR?