<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to run commands on the executor in Data Engineering</title>
    <link>https://community.databricks.com/t5/data-engineering/how-to-run-commands-on-the-executor/m-p/18929#M12621</link>
    <description>&lt;P&gt;It's not possible to use %sh to run commands on the executor. The below code can be used to run commands on the executor and get the output&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;var res=sc.runOnEachExecutor[String]({ () =&amp;gt;
import sys.process._
  
       var cmd_Result=Seq("bash", "-c", "hostname").!!
      cmd_Result
    }, 100.seconds)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Fri, 25 Jun 2021 19:19:42 GMT</pubDate>
    <dc:creator>brickster_2018</dc:creator>
    <dc:date>2021-06-25T19:19:42Z</dc:date>
    <item>
      <title>How to run commands on the executor</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-run-commands-on-the-executor/m-p/18928#M12620</link>
      <description>&lt;P&gt;Using %sh, I am able to run commands on the notebook and get output. How can i run a command on the executor and get the output. I want to avoid using the Spark API's&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jun 2021 19:17:59 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-run-commands-on-the-executor/m-p/18928#M12620</guid>
      <dc:creator>brickster_2018</dc:creator>
      <dc:date>2021-06-25T19:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to run commands on the executor</title>
      <link>https://community.databricks.com/t5/data-engineering/how-to-run-commands-on-the-executor/m-p/18929#M12621</link>
      <description>&lt;P&gt;It's not possible to use %sh to run commands on the executor. The below code can be used to run commands on the executor and get the output&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;var res=sc.runOnEachExecutor[String]({ () =&amp;gt;
import sys.process._
  
       var cmd_Result=Seq("bash", "-c", "hostname").!!
      cmd_Result
    }, 100.seconds)&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 25 Jun 2021 19:19:42 GMT</pubDate>
      <guid>https://community.databricks.com/t5/data-engineering/how-to-run-commands-on-the-executor/m-p/18929#M12621</guid>
      <dc:creator>brickster_2018</dc:creator>
      <dc:date>2021-06-25T19:19:42Z</dc:date>
    </item>
  </channel>
</rss>

