-
Notifications
You must be signed in to change notification settings - Fork 751
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[GOBBLIN-1841] Move disabling of current live instances to the GobblinClusterManager startup #3708
Merged
ZihanLi58
merged 12 commits into
apache:master
from
Peiyingy:py-move-disabling-of-current-live-instances-GOBBLIN-1841
Jun 30, 2023
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
0bbed58
[GOBBLIN-1841] Implement disableLiveHelixInstances and unit test
Peiyingy dd373d5
[GOBBLIN-1841] clear commit history
Peiyingy 3eecac5
[GOBBLIN-1841] remove disableLiveHelixInstances from Yarn
Peiyingy 2e10800
[GOBBLIN-1841] remove extra comments
Peiyingy df6d903
[GOBBLIN-1841] Implement TestGobblinClusterManager class
Peiyingy 0bb15ad
[GOBBLIN-1841] Remove unnecessary imports
Peiyingy 778b29f
[GOBBLIN-1841] Optimize imports
Peiyingy 7914810
[GOBBLIN-1841] Move disableTaskRunnersFromPreviousExecutions to Gobbl…
Peiyingy 42390b6
[GOBBLIN-1841] Add edge cases check
Peiyingy 331dd47
[GOBBLIN-1840] Fix checkstyle error
Peiyingy e3191b4
[GOBBLIN-1841] Fix GobblinYarnAppLauncherTest testJobCleanup
Peiyingy fabb39f
[GOBBLIN-1841] Add back javadoc to disableTaskRunnersFromPreviousExec…
Peiyingy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
gobblin-yarn/src/test/java/org/apache/gobblin/yarn/GobblinApplicationMasterTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* | ||
* 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.gobblin.yarn; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.apache.helix.HelixAdmin; | ||
import org.apache.helix.HelixDataAccessor; | ||
import org.apache.helix.HelixManager; | ||
import org.apache.helix.HelixProperty; | ||
import org.apache.helix.PropertyKey; | ||
import org.mockito.Mockito; | ||
import org.testng.annotations.Test; | ||
|
||
import junit.framework.TestCase; | ||
|
||
import org.apache.gobblin.cluster.GobblinHelixMultiManager; | ||
|
||
import static org.mockito.Mockito.times; | ||
import static org.mockito.Mockito.when; | ||
|
||
|
||
public class GobblinApplicationMasterTest extends TestCase { | ||
@Test | ||
public void testDisableTaskRunnersFromPreviousExecutions() { | ||
GobblinHelixMultiManager mockMultiManager = Mockito.mock(GobblinHelixMultiManager.class); | ||
|
||
HelixManager mockHelixManager = Mockito.mock(HelixManager.class); | ||
when(mockMultiManager.getJobClusterHelixManager()).thenReturn(mockHelixManager); | ||
|
||
HelixAdmin mockHelixAdmin = Mockito.mock(HelixAdmin.class); | ||
when(mockHelixManager.getClusterManagmentTool()).thenReturn(mockHelixAdmin); | ||
when(mockHelixManager.getClusterName()).thenReturn("mockCluster"); | ||
|
||
HelixDataAccessor mockAccessor = Mockito.mock(HelixDataAccessor.class); | ||
when(mockHelixManager.getHelixDataAccessor()).thenReturn(mockAccessor); | ||
|
||
PropertyKey.Builder mockBuilder = Mockito.mock(PropertyKey.Builder.class); | ||
when(mockAccessor.keyBuilder()).thenReturn(mockBuilder); | ||
|
||
PropertyKey mockLiveInstancesKey = Mockito.mock(PropertyKey.class); | ||
when(mockBuilder.liveInstances()).thenReturn(mockLiveInstancesKey); | ||
|
||
int instanceCount = 3; | ||
|
||
// GobblinYarnTaskRunner prefix would be disabled, while GobblinClusterManager prefix will not | ||
ArrayList<String> gobblinYarnTaskRunnerPrefix = new ArrayList<String>(); | ||
ArrayList<String> gobblinClusterManagerPrefix = new ArrayList<String>(); | ||
for (int i = 0; i < instanceCount; i++) { | ||
gobblinYarnTaskRunnerPrefix.add("GobblinYarnTaskRunner_TestInstance_" + i); | ||
gobblinClusterManagerPrefix.add("GobblinClusterManager_TestInstance_" + i); | ||
} | ||
|
||
Map<String, HelixProperty> mockChildValues = new HashMap<>(); | ||
for (int i = 0; i < instanceCount; i++) { | ||
mockChildValues.put(gobblinYarnTaskRunnerPrefix.get(i), Mockito.mock(HelixProperty.class)); | ||
mockChildValues.put(gobblinClusterManagerPrefix.get(i), Mockito.mock(HelixProperty.class)); | ||
} | ||
when(mockAccessor.getChildValuesMap(mockLiveInstancesKey)).thenReturn(mockChildValues); | ||
|
||
GobblinApplicationMaster.disableTaskRunnersFromPreviousExecutions(mockMultiManager); | ||
|
||
for (int i = 0; i < instanceCount; i++) { | ||
Mockito.verify(mockHelixAdmin).enableInstance("mockCluster", gobblinYarnTaskRunnerPrefix.get(i), false); | ||
Mockito.verify(mockHelixAdmin, times(0)).enableInstance("mockCluster", gobblinClusterManagerPrefix.get(i), false); | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add this comment back to the new impl