Guest User

Untitled

a guest
Nov 8th, 2018
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.72 KB | None | 0 0
  1. cls
  2.  
  3. $PuttyBasePath = "C:Program FilesPuTTY"
  4. $PlinkPath = $PuttyBasePath + "plink.exe"
  5. $PscpPath = $PuttyBasePath + "pscp.exe"
  6.  
  7. $SshHost = "someCluster-ssh.azurehdinsight.net"
  8. $SshUserName = "sshuser"
  9. $SshPassword = "somePassword"
  10.  
  11. $MainPath = "/home/sshuser/"
  12. $BaseDirectoryToUploadFiles = "/home/sshuser/testPath"
  13. $DirectoryToUploadFiles = $BaseDirectoryToUploadFiles + "20180505235534"
  14.  
  15. # Files to load
  16. $ConfigFilePath = "C:config.json"
  17. $JarFilePath = "C:somejar.jar"
  18.  
  19. function UploadFiles
  20. {
  21. &$PlinkPath -v -pw $SshPassword $SshUserName@$SshHost mkdir -p $DirectoryToUploadFiles
  22.  
  23. $FilesToUpload = @($JarFilePath, $ConfigFilePath)
  24.  
  25. foreach ($FileToUpload in $FilesToUpload)
  26. {
  27. &$PscpPath -v -pw $SshPassword -r $FileToUpload $SshUserName@${SshHost}:$DirectoryToUploadFiles
  28. }
  29. }
  30.  
  31.  
  32. function RunSparkJob
  33. {
  34. cls
  35.  
  36. echo y | &$PlinkPath -v -pw $SshPassword $SshUserName@$SshHost ("/usr/hdp/current/spark2-client/bin/spark-submit" +
  37. " --master yarn" +
  38. " --deploy-mode cluster" +
  39. " --conf spark.yarn.maxAppAttempts=8" +
  40. " --conf spark.yarn.am.attemptFailuresValidityInterval=1h" +
  41. " --conf spark.yarn.max.executor.failures=240" +
  42. " --conf spark.yarn.executor.failuresValidityInterval=1h" +
  43. " --conf spark.task.maxFailures=4" +
  44. " --conf spark.speculation=true" +
  45. " --conf spark.speculation.multiplier=40" +
  46. " --conf spark.speculation.quantile=0.85" +
  47. " --num-executors 30" +
  48. " --executor-cores 10" +
  49. " --files ${DirectoryToUploadFiles}/config.json" +
  50. " --packages org.apache.spark:spark-streaming_2.11:2.2.0,com.microsoft.azure:azure-eventhubs-spark_2.11:2.2.0" +
  51. " --class com.test.someClass ${DirectoryToUploadFiles}/somejar.jar")
  52. }
  53.  
  54. UploadFiles
  55. RunSparkJob
Add Comment
Please, Sign In to add comment