<?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>question How many times does the script used in spark pipes gets executed.? in Archives of Support Questions (Read Only)</title>
    <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-many-times-does-the-script-used-in-spark-pipes-gets/m-p/30893#M7041</link>
    <description>&lt;DIV class="post-text"&gt;I tried the below spark scala code and got the output as mentioned below. I have tried to pass the inputs to script, but it didn't receive and when i used collect the print statement i used in the script appeared twice.&lt;BR /&gt;&lt;BR /&gt;My simple and very basic perl script first:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;print("arguments $ARGV[0] \n"); // Just print the arguments.&lt;BR /&gt;&lt;BR /&gt;My Spark code:&lt;BR /&gt;&lt;BR /&gt;object PipesExample {&lt;BR /&gt;&amp;nbsp; def main(args:Array[String]){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; val conf = new SparkConf();&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; val sc = new SparkContext(conf);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; val distScript = "/home/srinivas/test.pl"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sc.addFile(distScript)&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; val rdd = sc.parallelize(Array("srini"))&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; val piped = rdd.pipe(Seq(SparkFiles.get("test.pl")))&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; println(" output " + piped.collect().mkString(" "));&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Output looked like this..&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;output: arguments arguments&lt;BR /&gt;&lt;BR /&gt;1) What mistake i have done to make it fail receiving the arguments.? 2) Why it executed twice.?&lt;BR /&gt;&lt;BR /&gt;If it looks too basic, please apologize me. I was trying to understand to the best and want to clear my doubts.&lt;/DIV&gt;</description>
    <pubDate>Fri, 16 Sep 2022 09:38:05 GMT</pubDate>
    <dc:creator>Srini_D</dc:creator>
    <dc:date>2022-09-16T09:38:05Z</dc:date>
    <item>
      <title>How many times does the script used in spark pipes gets executed.?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-many-times-does-the-script-used-in-spark-pipes-gets/m-p/30893#M7041</link>
      <description>&lt;DIV class="post-text"&gt;I tried the below spark scala code and got the output as mentioned below. I have tried to pass the inputs to script, but it didn't receive and when i used collect the print statement i used in the script appeared twice.&lt;BR /&gt;&lt;BR /&gt;My simple and very basic perl script first:&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/perl&lt;BR /&gt;print("arguments $ARGV[0] \n"); // Just print the arguments.&lt;BR /&gt;&lt;BR /&gt;My Spark code:&lt;BR /&gt;&lt;BR /&gt;object PipesExample {&lt;BR /&gt;&amp;nbsp; def main(args:Array[String]){&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; val conf = new SparkConf();&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; val sc = new SparkContext(conf);&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; val distScript = "/home/srinivas/test.pl"&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sc.addFile(distScript)&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; val rdd = sc.parallelize(Array("srini"))&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; val piped = rdd.pipe(Seq(SparkFiles.get("test.pl")))&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; println(" output " + piped.collect().mkString(" "));&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; }&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Output looked like this..&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;output: arguments arguments&lt;BR /&gt;&lt;BR /&gt;1) What mistake i have done to make it fail receiving the arguments.? 2) Why it executed twice.?&lt;BR /&gt;&lt;BR /&gt;If it looks too basic, please apologize me. I was trying to understand to the best and want to clear my doubts.&lt;/DIV&gt;</description>
      <pubDate>Fri, 16 Sep 2022 09:38:05 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-many-times-does-the-script-used-in-spark-pipes-gets/m-p/30893#M7041</guid>
      <dc:creator>Srini_D</dc:creator>
      <dc:date>2022-09-16T09:38:05Z</dc:date>
    </item>
    <item>
      <title>Re: How many times does the script used in spark pipes gets executed.?</title>
      <link>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-many-times-does-the-script-used-in-spark-pipes-gets/m-p/30908#M7042</link>
      <description>&lt;P&gt;How many executors do you have when you run this?&lt;/P&gt;&lt;P&gt;I see the same when I run it because it gets sent to each executor (2 in my case)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Wilfred&lt;/P&gt;</description>
      <pubDate>Wed, 19 Aug 2015 02:28:16 GMT</pubDate>
      <guid>https://community.cloudera.com/t5/Archives-of-Support-Questions/How-many-times-does-the-script-used-in-spark-pipes-gets/m-p/30908#M7042</guid>
      <dc:creator>Wilfred</dc:creator>
      <dc:date>2015-08-19T02:28:16Z</dc:date>
    </item>
  </channel>
</rss>

