psavalle commented on code in PR #56516:
URL: https://github.com/apache/spark/pull/56516#discussion_r3802447322


##########
core/src/main/scala/org/apache/spark/scheduler/DAGScheduler.scala:
##########
@@ -645,17 +645,10 @@ private[spark] class DAGScheduler(
         val startResourceProfile = stageResourceProfiles.head
         val mergedProfile = stageResourceProfiles.drop(1)
           .foldLeft(startResourceProfile)((a, b) => mergeResourceProfiles(a, 
b))
-        // compared merged profile with existing ones so we don't add it over 
and over again
-        // if the user runs the same operation multiple times
-        val resProfile = 
sc.resourceProfileManager.getEquivalentProfile(mergedProfile)
-        resProfile match {
-          case Some(existingRp) => existingRp
-          case None =>
-            // this ResourceProfile could be different if it was merged so we 
have to add it to
-            // our ResourceProfileManager
-            sc.resourceProfileManager.addResourceProfile(mergedProfile)
-            mergedProfile
-        }
+        // compare the merged profile with existing ones so we don't add it 
over and over again
+        // if the user runs the same operation multiple times. The merged 
ResourceProfile could
+        // be different from any existing one, in which case it is registered 
here.
+        sc.resourceProfileManager.getOrAddEquivalentProfile(mergedProfile)

Review Comment:
   Switched to using a read lock. I've kept the change to use the atomic call 
here so we don't restore the race that was present in the original code.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to