您好,登錄后才能下訂單哦!
小編給大家分享一下spark如何合并github,希望大家閱讀完這篇文章之后都有所收獲,下面讓我們一起去探討吧!
最近在做內部spark版本升級的工作,涉及到github 上合并pr的工作,具體的是spark 2.x升級到spark 3.0.1時兼容hdfs cdh-2.6.0-5.13.1,報編譯錯誤
[INFO] Compiling 25 Scala sources to /Users/libinsong/Documents/codes/tongdun/spark-3.0/resource-managers/yarn/target/scala-2.12/classes ... [ERROR] [Error] resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala:298: value setRolledLogsIncludePattern is not a member of org.apache.hadoop.yarn.api.records.LogAggregationContext [ERROR] [Error] resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala:300: value setRolledLogsExcludePattern is not a member of org.apache.hadoop.yarn.api.records.LogAggregationContext [ERROR] [Error] resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala:551: not found: value isLocalUri [ERROR] [Error] resource-managers/yarn/src/main/scala/org/apache/spark/deploy/yarn/Client.scala:1367: not found: value isLocalUri [ERROR] four errors found
具體的解決方法github spark pr 已經給出了解決方法,修改相應的代碼就行,但是僅僅是修改的話,我們可以選擇一種更加優雅的方式(以git cherry-pick方式),
現在簡單的分享一下:
直接找到setRolledLogsIncludePattern一行,
sparkConf.get(ROLLED_LOG_INCLUDE_PATTERN).foreach { includePattern => try { val logAggregationContext = Records.newRecord(classOf[LogAggregationContext]) logAggregationContext.setRolledLogsIncludePattern(includePattern) sparkConf.get(ROLLED_LOG_EXCLUDE_PATTERN).foreach { excludePattern => logAggregationContext.setRolledLogsExcludePattern(excludePattern) } appContext.setLogAggregationContext(logAggregationContext) } catch { case NonFatal(e) => logWarning(s"Ignoring ${ROLLED_LOG_INCLUDE_PATTERN.key} because the version of YARN " + "does not support it", e) } } appContext.setUnmanagedAM(isClientUnmanagedAMEnabled) sparkConf.get(APPLICATION_PRIORITY).foreach { appPriority => appContext.setPriority(Priority.newInstance(appPriority)) } appContext }
發現master上的代碼并不是我們想要的,這個時候我們就可以使用git blame,在github上為
這樣我們就能發現該代碼有多次修改,找到對應[SPARK-19545][YARN] Fix compile issue for Spark on Yarn when building… 點擊進去
找到對應的commitId
執行命令 git cherry-pick 8e8afb3a3468aa743d13e23e10e77e94b772b2ed 就能把該commit 追加到自己的工作目錄下
這樣既能不需要手動修改代碼,也能很好的保存了原始的commit的信息,以便追蹤
看完了這篇文章,相信你對“spark如何合并github”有了一定的了解,如果想了解更多相關知識,歡迎關注億速云行業資訊頻道,感謝各位的閱讀!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。