Re: Long-Running Spark application doesn't clean old shuffle data correctly

2019-07-20 Thread Aayush Ranaut
This is the job of ContextCleaner. There are few a property that you can tweak 
to see if that helps: 
spark.cleaner.periodicGC.interval

spark.cleaner.referenceTracking

spark.cleaner.referenceTracking.blocking.shuffle



Regards

Prathmesh Ranaut

> On Jul 21, 2019, at 11:36 AM, Prathmesh Ranaut Gmail 
>  wrote:
> 
> 
> This is the job of ContextCleaner. There are few a property that you can 
> tweak to see if that helps: 
> spark.cleaner.periodicGC.interval
> 
> spark.cleaner.referenceTracking
> 
> spark.cleaner.referenceTracking.blocking.shuffle
> 
> 
> 
> Regards
> 
> Prathmesh Ranaut
>> On Jul 21, 2019, at 11:31 AM, Alex Landa  wrote:
>> 
>> 
>> Hi,
>> 
>> We are running a long running Spark application ( which executes lots of
>> quick jobs using our scheduler ) on Spark stand-alone cluster 2.4.0.
>> We see that old shuffle files ( a week old for example ) are not deleted
>> during the execution of the application, which leads to out of disk space
>> errors on the executor. 
>> If we re-deploy the application, the Spark cluster take care of the cleaning
>> and deletes the old shuffle data (since we have
>> /-Dspark.worker.cleanup.enabled=true/ in the worker config).
>> I don't want to re-deploy our app every week or two, but to be able to
>> configure spark to clean old shuffle data (as it should). 
>> 
>> How can I configure Spark to delete old shuffle data during the life time of
>> the application (not after)? 
>> 
>> 
>> Thanks,
>> Alex


Long-Running Spark application doesn't clean old shuffle data correctly

2019-07-20 Thread Alex Landa
Hi,

We are running a long running Spark application ( which executes lots of
quick jobs using our scheduler ) on Spark stand-alone cluster 2.4.0.
We see that old shuffle files ( a week old for example ) are not deleted
during the execution of the application, which leads to out of disk space
errors on the executor.
If we re-deploy the application, the Spark cluster take care of the cleaning
and deletes the old shuffle data (since we have
/-Dspark.worker.cleanup.enabled=true/ in the worker config).
I don't want to re-deploy our app every week or two, but to be able to
configure spark to clean old shuffle data (as it should).

How can I configure Spark to delete old shuffle data during the life time of
the application (not after)?


Thanks,
Alex


How to get loss per iteration in Spark MultilayerPerceptronClassificationModel?

2019-07-20 Thread Shamshad Ansari
Hello All,
Apache Spark ML's LogisticRegressionModel has summary().objectHistory()
method. Is there any such method available for
MultilayerPerceptronClassificationModel? If not, what’s a way to get loss
per iteration? Any help is greatly appreaciated. Thank you.


Re: Spark SaveMode

2019-07-20 Thread Mich Talebzadeh
JDBC read from Oracle table requires Oracle jdbc driver ojdbc6.jar or
higher. ojdbc6.jar works for 11 and 12c added as --jars /ojdbc6.jar

Example with parallel read  (4 connections) to Oracle with ID being your PK
in Oracle table

var _ORACLEserver= "jdbc:oracle:thin:@rhes564:1521:mydb12"
var _username = "scratchpad"
var _password = ""
//
//
// Get minID and maxID first
//
val minID = HiveContext.read.format("jdbc").options(Map("url" ->
_ORACLEserver,"dbtable" -> "(SELECT cast(MIN(ID) AS INT) AS maxID FROM
scratchpad.dummy)",
   "user" -> _username, "password" ->
_password)).load().collect.apply(0).getDecimal(0).toString
val maxID = HiveContext.read.format("jdbc").options(Map("url" ->
_ORACLEserver,"dbtable" -> "(SELECT cast(MAX(ID) AS INT) AS maxID FROM
scratchpad.dummy)",
   "user" -> _username, "password" ->
_password)).load().collect.apply(0).getDecimal(0).toString
val s = HiveContext.read.format("jdbc").options(
   Map("url" -> _ORACLEserver,
   "dbtable" -> "(SELECT ID, CLUSTERED, SCATTERED, RANDOMISED,
RANDOM_STRING, SMALL_VC, PADDING FROM scratchpad.dummy)",
   "partitionColumn" -> "ID",
   "lowerBound" -> minID,
   "upperBound" -> maxID,
   "numPartitions" -> "4",
   "user" -> _username,
   "password" -> _password)).load

HTH

Dr Mich Talebzadeh



LinkedIn * 
https://www.linkedin.com/profile/view?id=AAEWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw
*



http://talebzadehmich.wordpress.com


*Disclaimer:* Use it at your own risk. Any and all responsibility for any
loss, damage or destruction of data or any other property which may arise
from relying on this email's technical content is explicitly disclaimed.
The author will in no case be liable for any monetary damages arising from
such loss, damage or destruction.




On Sat, 20 Jul 2019 at 07:42, Mich Talebzadeh 
wrote:

> This behaviour is governed by the underlying RDBMS for bulk insert, where
> it either commits or roll backs.
>
> You can insert new rows into an staging table in Oracle (which is common
> in ETL) and then insert/select into Oracle table in shell routine.
>
> The other way is to use JDBC in Spark to read Oracle table into a DF and
> do a result set with Oracle DF and your DF and insert only those records
> into Oracle.
>
> HTH
>
> Dr Mich Talebzadeh
>
>
>
> LinkedIn * 
> https://www.linkedin.com/profile/view?id=AAEWh2gBxianrbJd6zP6AcPCCdOABUrV8Pw
> *
>
>
>
> http://talebzadehmich.wordpress.com
>
>
> *Disclaimer:* Use it at your own risk. Any and all responsibility for any
> loss, damage or destruction of data or any other property which may arise
> from relying on this email's technical content is explicitly disclaimed.
> The author will in no case be liable for any monetary damages arising from
> such loss, damage or destruction.
>
>
>
>
> On Sat, 20 Jul 2019 at 05:35, Richard  wrote:
>
>> Any reason why Spark's SaveMode doesn't have mode that ignore any Primary
>> Key/Unique constraint violations?
>>
>> Let's say I'm using spark to migrate some data from Cassandra to Oracle,
>> I want the insert operation to be "ignore if exist primary keys" instead of
>> failing the whole batch.
>>
>> Thanks,
>> Richard
>>
>>