-
Notifications
You must be signed in to change notification settings - Fork 10
DG-1924 | Add 'assetsCountToPropagate' and 'assetsCountPropagated' in task vertex. #4032
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
base: master
Are you sure you want to change the base?
Changes from 10 commits
759f717
65d920d
61d58dd
dfddb79
b4ce7af
ed847c1
c257421
adc6ed1
fdca703
164ec29
4e8c6df
d046141
288062c
ae9dec1
a13f17e
d364c8e
b9b6887
317322e
7cf3072
ba5d144
14db31d
102ae40
64775b4
42540a0
97bbbaf
42b074a
c7c8c4e
6eaf1eb
5caa581
6d176e7
6451bfd
e51846d
48e07f4
547d561
616dcef
06fb81c
cab6deb
157e2db
06e406a
3936029
de81019
720cda0
1b4dbee
e66c636
0f6af6d
73c7cd8
edebe8c
6961d65
5f31f32
8063ff0
b0aadc1
5d31524
08fa364
77dd858
817418b
613db6c
18ccd0f
d7f5e47
4e6eb48
0d8bdf9
386b92c
850fffe
65cb0fb
6aede5c
22e973a
2991b78
75a8e14
bc27ce9
0b8dcd0
754ceb0
e297cae
c1de532
c1fa864
6abecbb
a4b9046
050c1f3
c35fde8
fda9378
7c89b28
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 |
|---|---|---|
|
|
@@ -60,8 +60,8 @@ | |
| import org.slf4j.LoggerFactory; | ||
| import static org.apache.atlas.repository.graph.GraphHelper.getTypeName; | ||
|
|
||
|
|
||
| import java.util.*; | ||
| import java.util.function.BiConsumer; | ||
abhijeet-atlan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| import java.util.stream.Collectors; | ||
|
|
||
| import static org.apache.atlas.AtlasClient.DATA_SET_SUPER_TYPE; | ||
|
|
@@ -96,7 +96,22 @@ public abstract class DeleteHandlerV1 { | |
| private final TaskManagement taskManagement; | ||
| private final AtlasGraph graph; | ||
| private final TaskUtil taskUtil; | ||
| private static final int CHUNK_SIZE = AtlasConfiguration.TASKS_GRAPH_COMMIT_CHUNK_SIZE.getInt(); | ||
|
|
||
| public void updateTaskVertexProperty(String propertyKey, long value, boolean isIncremental, BiConsumer<AtlasTask, Long> taskSetter) { | ||
| AtlasTask currentTask = RequestContext.get().getCurrentTask(); | ||
| AtlasVertex currentTaskVertex = (AtlasVertex) graph.query() | ||
| .has(TASK_GUID, currentTask.getGuid()) | ||
| .vertices().iterator().next(); | ||
|
|
||
| Long valueFromTaskVertex = currentTaskVertex.getProperty(propertyKey, Long.class); | ||
| long valueToPushToTaskVertex = isIncremental ? (valueFromTaskVertex != null ? valueFromTaskVertex : 0L) + value : value; | ||
| if (taskSetter != null) { | ||
| taskSetter.accept(currentTask, valueToPushToTaskVertex); | ||
| } | ||
|
|
||
| currentTaskVertex.setProperty(propertyKey, valueToPushToTaskVertex); | ||
abhijeet-atlan marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| public DeleteHandlerV1(AtlasGraph graph, AtlasTypeRegistry typeRegistry, boolean shouldUpdateInverseReference, boolean softDelete, TaskManagement taskManagement) { | ||
| this.typeRegistry = typeRegistry; | ||
|
|
@@ -1220,16 +1235,32 @@ public void updateTagPropagations(AtlasEdge edge, AtlasRelationship relationship | |
| } | ||
| } | ||
|
|
||
| taskManagement.updateTaskVertexProperty(TASK_ASSET_COUNT_TO_PROPAGATE, graph, addPropagationsMap.size() + removePropagationsMap.size(), false, AtlasTask::setAssetsCountToPropagate); | ||
|
|
||
| int propagatedCount = 0; | ||
| for (AtlasVertex classificationVertex : addPropagationsMap.keySet()) { | ||
| List<AtlasVertex> entitiesToAddPropagation = addPropagationsMap.get(classificationVertex); | ||
|
|
||
| addTagPropagation(classificationVertex, entitiesToAddPropagation); | ||
| propagatedCount++; | ||
| if (propagatedCount == CHUNK_SIZE){ | ||
|
||
| taskManagement.updateTaskVertexProperty(TASK_ASSET_COUNT_PROPAGATED, graph, propagatedCount - 1, true, AtlasTask::setAssetsCountPropagated); | ||
| propagatedCount = 0; | ||
| } | ||
| } | ||
|
|
||
| for (AtlasVertex classificationVertex : removePropagationsMap.keySet()) { | ||
| List<AtlasVertex> entitiesToRemovePropagation = removePropagationsMap.get(classificationVertex); | ||
|
|
||
| removeTagPropagation(classificationVertex, entitiesToRemovePropagation); | ||
| propagatedCount++; | ||
| if (propagatedCount == CHUNK_SIZE){ | ||
| taskManagement.updateTaskVertexProperty(TASK_ASSET_COUNT_PROPAGATED, graph, propagatedCount, true, AtlasTask::setAssetsCountPropagated); | ||
| propagatedCount = 0; | ||
| } | ||
| } | ||
| if (propagatedCount != 0){ | ||
| taskManagement.updateTaskVertexProperty(TASK_ASSET_COUNT_PROPAGATED, graph, propagatedCount, true, AtlasTask::setAssetsCountPropagated); | ||
| } | ||
| } else { | ||
| // update blocked propagated classifications only if there is no change is tag propagation (don't update both) | ||
|
|
||

Uh oh!
There was an error while loading. Please reload this page.