You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Snehal Nagmote <na...@gmail.com> on 2015/10/01 19:44:33 UTC

Getting spark application driver ID programmatically

Hi ,

I have use case where we need to automate start/stop of spark streaming
application.

To stop spark job, we need driver/application id of the job .

For example :

/app/spark-master/bin/spark-class org.apache.spark.deploy.Client kill
spark://10.65.169.242:7077 $driver_id

I am thinking to get the driver id when we submit the job in verbose mode ,
by parsing the output .

Does spark provide any api where it provides driver id of application .

Is there any better or cleaner way to get driver ID ?


Any suggestions would be helpful  ,

Thanks,
Snehal

Re: Getting spark application driver ID programmatically

Posted by Igor Berman <ig...@gmail.com>.
if driver id is application id then yes you can do it with
String appId = ctx.sc().applicationId(); //when ctx is java context


On 1 October 2015 at 20:44, Snehal Nagmote <na...@gmail.com> wrote:

> Hi ,
>
> I have use case where we need to automate start/stop of spark streaming
> application.
>
> To stop spark job, we need driver/application id of the job .
>
> For example :
>
> /app/spark-master/bin/spark-class org.apache.spark.deploy.Client kill
> spark://10.65.169.242:7077 $driver_id
>
> I am thinking to get the driver id when we submit the job in verbose mode
> , by parsing the output .
>
> Does spark provide any api where it provides driver id of application .
>
> Is there any better or cleaner way to get driver ID ?
>
>
> Any suggestions would be helpful  ,
>
> Thanks,
> Snehal
>
>