-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
spark support yarn cluster #4850
Changes from all commits
3d4f204
5723be6
0bd1796
8a70c34
cf8740d
679885d
ec67464
160ab55
e676775
bfa6fba
852131b
dd06fc1
28e5730
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -196,6 +196,44 @@ public void updateLabelsToNode(ServiceInstance instance, List<Label<?>> labels) | |
} | ||
} | ||
|
||
@Override | ||
public void labelsFromInstanceToNewInstance( | ||
ServiceInstance oldServiceInstance, ServiceInstance newServiceInstance) { | ||
List<PersistenceLabel> labels = | ||
labelManagerPersistence.getLabelByServiceInstance(newServiceInstance); | ||
List<String> newKeyList = labels.stream().map(Label::getLabelKey).collect(Collectors.toList()); | ||
List<PersistenceLabel> nodeLabels = | ||
labelManagerPersistence.getLabelByServiceInstance(oldServiceInstance); | ||
|
||
List<String> oldKeyList = | ||
nodeLabels.stream().map(InheritableLabel::getLabelKey).collect(Collectors.toList()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It shouldn’t be so complicated here, we only need to first get the new instance tag, then get the old instance tag, then delete the duplicate tag in the old tag, and then associate the new instance with the old tag just go |
||
|
||
List<String> willBeAdd = new ArrayList<>(oldKeyList); | ||
willBeAdd.removeAll(newKeyList); | ||
|
||
// Assign the old association to the newServiceInstance | ||
if (!CollectionUtils.isEmpty(willBeAdd)) { | ||
nodeLabels.forEach( | ||
nodeLabel -> { | ||
if (willBeAdd.contains(nodeLabel.getLabelKey())) { | ||
PersistenceLabel persistenceLabel = | ||
LabelManagerUtils.convertPersistenceLabel(nodeLabel); | ||
int labelId = tryToAddLabel(persistenceLabel); | ||
if (labelId > 0) { | ||
List<Integer> labelIds = new ArrayList<>(); | ||
labelIds.add(labelId); | ||
labelManagerPersistence.addLabelToNode(newServiceInstance, labelIds); | ||
} | ||
} | ||
}); | ||
} | ||
|
||
// Delete an old association | ||
List<Integer> oldLabelId = | ||
nodeLabels.stream().map(PersistenceLabel::getId).collect(Collectors.toList()); | ||
labelManagerPersistence.removeNodeLabels(oldServiceInstance, oldLabelId); | ||
} | ||
|
||
/** | ||
* Remove the labels related by node instance | ||
* | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* 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.linkis.manager.label.entity.engine; | ||
|
||
import org.apache.linkis.manager.label.constant.LabelKeyConstant; | ||
import org.apache.linkis.manager.label.entity.*; | ||
import org.apache.linkis.manager.label.entity.annon.ValueSerialNum; | ||
import org.apache.linkis.manager.label.exception.LabelErrorException; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
|
||
import java.util.HashMap; | ||
|
||
import static org.apache.linkis.manager.label.errorcode.LabelCommonErrorCodeSummary.CHECK_LABEL_VALUE_EMPTY; | ||
import static org.apache.linkis.manager.label.errorcode.LabelCommonErrorCodeSummary.LABEL_ERROR_CODE; | ||
|
||
public class EngingeConnRuntimeModeLabel extends GenericLabel | ||
implements EngineNodeLabel, UserModifiable { | ||
|
||
public EngingeConnRuntimeModeLabel() { | ||
setLabelKey(LabelKeyConstant.ENGINGE_CONN_RUNTIME_MODE_KEY); | ||
} | ||
|
||
@ValueSerialNum(0) | ||
public void setModeValue(String modeValue) { | ||
if (getValue() == null) { | ||
setValue(new HashMap<>()); | ||
} | ||
getValue().put("modeValue", modeValue); | ||
} | ||
|
||
public String getModeValue() { | ||
if (getValue() == null) { | ||
return null; | ||
} | ||
return getValue().get("modeValue"); | ||
} | ||
|
||
@Override | ||
public Feature getFeature() { | ||
return Feature.CORE; | ||
} | ||
|
||
@Override | ||
public void valueCheck(String stringValue) throws LabelErrorException { | ||
if (!StringUtils.isBlank(stringValue)) { | ||
if (stringValue.split(SerializableLabel.VALUE_SEPARATOR).length != 1) { | ||
throw new LabelErrorException( | ||
LABEL_ERROR_CODE.getErrorCode(), LABEL_ERROR_CODE.getErrorDesc()); | ||
} | ||
} else { | ||
throw new LabelErrorException( | ||
CHECK_LABEL_VALUE_EMPTY.getErrorCode(), CHECK_LABEL_VALUE_EMPTY.getErrorDesc()); | ||
} | ||
} | ||
} |
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.
You should first org.apache.linkis.manager.am.manager.EngineNodeManager#updateEngineNode and then update label