<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # 解釋員執行Hook(實驗) 原文鏈接 : [http://zeppelin.apache.org/docs/0.7.2/manual/interpreterexechooks.html](http://zeppelin.apache.org/docs/0.7.2/manual/interpreterexechooks.html) 譯文鏈接 : [http://www.apache.wiki/pages/viewpage.action?pageId=10030757](http://www.apache.wiki/pages/viewpage.action?pageId=10030757) 貢獻者 : [片刻](/display/~jiangzhonglian) [ApacheCN](/display/~apachecn) [Apache中文網](/display/~apachechina) ## 概述 Apache Zeppelin允許用戶在前后段代碼執行時指定由解釋器執行的附加代碼。如果您需要在特定時間為筆記本中的所有段落運行相同的代碼集,這主要是有用的。目前,此功能僅適用于spark和pyspark解釋器。要指定你的Hook代碼,你可以使用`z.registerHook()`。例如,將以下內容輸入到一個段落中: ``` %pyspark z.registerHook("post_exec", "print 'This code should be executed before the parapgraph code!'") z.registerHook("pre_exec", "print 'This code should be executed after the paragraph code!'")? ``` 這些調用在下一次運行一段時才會生效。 在另一段中,輸入 ``` %pyspark print "This code should be entered into the paragraph by the user!"? ``` 輸出應為: ``` This code should be executed before the paragraph code! This code should be entered into the paragraph by the user! This code should be executed after the paragraph code! ? ``` 如果你需要知道鉤子代碼,請使用`z.getHook()`: ``` %pyspark print z.getHook("post_exec") print 'This code should be executed after the paragraph code!'? ``` 任何調用`z.registerHook()`將自動覆蓋以前注冊的內容。要完全注銷掛鉤事件,請使用`z.unregisterHook(eventCode)`。目前只有`"post_exec"`和`"pre_exec"`Zeppelin Hook注冊表系統的有效的事件代碼。 最后,hook注冊表由同一組中的其他解釋器內部共享。這將允許一個解釋器REPL的鉤子代碼由另一個解釋器設置,如下所示: ``` %spark z.unregisterHook("post_exec", "pyspark")? ``` 該API對于spark(scala)和pyspark(python)實現是相同的。 ### 注意事項 打電話`z.registerHook("pre_exec", ...)`應小心。如果您指定的鉤子代碼有錯誤,這將導致解釋器REPL無法執行任何代碼通過預執行階段,使得直接調用不可能`z.unregisterHook()`生效。當前的解決方法包括`z.unregisterHook()`通過同一解釋器組(見上文)中的其他解釋器REPL進行調用,或者在UI中手動重新啟動解釋器組。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看