You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@samza.apache.org by ca...@apache.org on 2021/04/29 18:04:08 UTC
[samza] branch master updated: SAMZA-2648: Add simple placeholder
FaultDomainManager for when YARN is not used (#1494)
This is an automated email from the ASF dual-hosted git repository.
cameronlee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/samza.git
The following commit(s) were added to refs/heads/master by this push:
new 2563caa SAMZA-2648: Add simple placeholder FaultDomainManager for when YARN is not used (#1494)
2563caa is described below
commit 2563caafcb53c913c6f40342219480e7ef56aa34
Author: Cameron Lee <ca...@linkedin.com>
AuthorDate: Thu Apr 29 11:03:57 2021 -0700
SAMZA-2648: Add simple placeholder FaultDomainManager for when YARN is not used (#1494)
Issues: There is currently only one concrete FaultDomainManager implementation, and it is for YARN usage. It is also specified as the default in code. However, for non-YARN environments (such as Kubernetes), we shouldn't include YARN dependencies, so we need another concrete implementation. For now, we can just add a very simple implementation as a placeholder.
Changes: Added SingleFaultDomainManager which is a simple impl of FaultDomainManager which only has a single fault domain. This isn't wired in anywhere, but a job can configure it as the FaultDomainManager if desirable. Any features which depend on fault domain awareness won't work (e.g. using standby containers with cluster-manager.fault-domain-aware.standby.enabled = true won't work), but it can still be a useful placeholder when standby containers are not needed.
API changes and usage/upgrade instructions:
Set the config cluster-manager.fault-domain-manager.factory to org.apache.samza.clustermanager. SingleFaultDomainManagerFactory to use this new fault domain manager.
---
.../clustermanager/SingleFaultDomainManager.java | 48 ++++++++++++++++++++++
.../SingleFaultDomainManagerFactory.java | 34 +++++++++++++++
2 files changed, 82 insertions(+)
diff --git a/samza-core/src/main/java/org/apache/samza/clustermanager/SingleFaultDomainManager.java b/samza-core/src/main/java/org/apache/samza/clustermanager/SingleFaultDomainManager.java
new file mode 100644
index 0000000..34a5aad
--- /dev/null
+++ b/samza-core/src/main/java/org/apache/samza/clustermanager/SingleFaultDomainManager.java
@@ -0,0 +1,48 @@
+/*
+ * 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 org.apache.samza.clustermanager;
+
+import java.util.Collections;
+import java.util.Set;
+
+
+/**
+ * Simple placeholder implementation of {@link FaultDomainManager} which contains a single fault domain for all hosts.
+ * This can be used when another concrete {@link FaultDomainManager} is undesirable or unavailable, but features which
+ * depend on a {@link FaultDomainManager} (such as standby containers) may have unexpected behavior.
+ */
+public class SingleFaultDomainManager implements FaultDomainManager {
+ private static final FaultDomain SINGLE_FAULT_DOMAIN = new FaultDomain(FaultDomainType.RACK, "0");
+
+ @Override
+ public Set<FaultDomain> getAllFaultDomains() {
+ return Collections.singleton(SINGLE_FAULT_DOMAIN);
+ }
+
+ @Override
+ public Set<FaultDomain> getFaultDomainsForHost(String host) {
+ return Collections.singleton(SINGLE_FAULT_DOMAIN);
+ }
+
+ @Override
+ public boolean hasSameFaultDomains(String host1, String host2) {
+ return true;
+ }
+}
diff --git a/samza-core/src/main/java/org/apache/samza/clustermanager/SingleFaultDomainManagerFactory.java b/samza-core/src/main/java/org/apache/samza/clustermanager/SingleFaultDomainManagerFactory.java
new file mode 100644
index 0000000..db96b15
--- /dev/null
+++ b/samza-core/src/main/java/org/apache/samza/clustermanager/SingleFaultDomainManagerFactory.java
@@ -0,0 +1,34 @@
+/*
+ * 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 org.apache.samza.clustermanager;
+
+import org.apache.samza.config.Config;
+import org.apache.samza.metrics.MetricsRegistry;
+
+
+/**
+ * Produces a simple placeholder {@link FaultDomainManager}. See {@link SingleFaultDomainManager}.
+ */
+public class SingleFaultDomainManagerFactory implements FaultDomainManagerFactory {
+ @Override
+ public FaultDomainManager getFaultDomainManager(Config config, MetricsRegistry metricsRegistry) {
+ return new SingleFaultDomainManager();
+ }
+}