Cassandra copy works first time but after iteration it creates unnecessary python processes that blocks system memory <p>My code is as below it works first time perfectly but after second or third iteration it creates so many python processes some times it blocks sometimes 4gb of system memory and process cant executing properly.</p> <p>Some time if i try same eclipse console printed output query on terminal it works on some cassandra nodes but not on all. I also tried scala !,!! Methods also.</p> <p>I am not getting this is exact issue of cassandra or Scala process builder ?</p> <pre><code>def copyPartitioncassandra(tbls: tblInfo, srcpth: String, colDelimr: String, NoOfParts: Int): Boolean = { var qry: String = "" for (x &lt;- 0 to NoOfParts - 1) { if (new File(srcpth+ "/part-" + "%05d".format(x)).length() &gt; 0) qry = qry + "COPY " + tbls.keySpaceName + "." + tbls.tblName + "(" + tbls.header + ") FROM '" + srcpth + "/part-" + "%05d".format(x) + "' WITH DELIMITER = '" + colDelimr + "' AND NULL = '' AND MAXATTEMPTS=3;" + "\n" } var qry_file = extraconfig.getString("QUERY_FILE_PATH ") + tbls.tblName + ".txt" createTxtFile(qry, qry_file) qry = "cqlsh " + extraconfig.getString("CASSANDRA_DB_IP") + " -k " + tbls.keySpaceName + " -f " + qry_file println(qry) var test = qry.run() true } </code></pre>