Github user ishark commented on a diff in the pull request:
https://github.com/apache/incubator-apex-core/pull/250#discussion_r57506922
--- Diff: api/src/main/java/com/datatorrent/api/DAG.java ---
@@ -250,6 +250,24 @@
public abstract <T> void setAttribute(Operator operator, Attribute<T>
key, T value);
/**
+ * Set affinity between operators
+ * @param locality
+ * @param relaxLocality
+ * @param first operator
+ * @param one or more operators
+ */
+ public abstract void setAffinity(Locality locality, boolean
relaxLocality, String firstOperator, String... operators);
--- End diff --
Yes, the affinity/anti-affinity can be set from attributes directly. These
were added as convenience methods as per discussion on dev mailing list. Here
are sample usages with these methods:
https://github.com/ishark/Apex-Samples/blob/master/affinity-example/src/main/java/com/example/affinity/ApplicationDagAPIs.java#L33-L34
Compared to when setting via attributes:
https://github.com/ishark/Apex-Samples/blob/master/affinity-example/src/main/java/com/example/affinity/ApplicationDagContext.java#L42-L54
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---