Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Stopping selected roles from Service action menu in a CSD

Solved Go to solution

Stopping selected roles from Service action menu in a CSD

New Contributor

I have written a CSD that has several roles. I am ideally trying to stop the selected roles in the "actions for selected" menu in the Service -> instances tab.

To invoke the "stop" action for a role, I tried writing a stopRunner similar to the startRunner fo the role 

"roles" : [

  {

   "name" : "ECHO_WEBSERVER",

   "label" : "Web Server",

   "pluralLabel" : "Web Servers",

   "startRunner" : {  

           "program" : "scripts/control.sh",  

           "args" : [ "start" ],  

           "environmentVariables" : {    

                      "WEBSERVER_PORT" : "${port_num}"  

                  }

       },

     "stopRunner" : {  

              "program" : "scripts/control.sh",  

              "args" : [ "stop" ]  } 

        

    }

]

However, that didn't work and tried "stopRunner" similar to the service syntax

"roles" : [

  {

   "name" : "ECHO_WEBSERVER",

   "label" : "Web Server",

   "pluralLabel" : "Web Servers",

   "startRunner" : {  

           "program" : "scripts/control.sh",  

           "args" : [ "start" ],  

           "environmentVariables" : {    

                      "WEBSERVER_PORT" : "${port_num}"  

                  }

       },

   

"stopRunner" : {

    "runner" : {

      "program" : "scripts/control.sh",

      "args" : ["stop"]

    },

    "timeout" : 180000,

    "masterRole" : "ECHO_WEBSERVER"

  }

        

    }

]

That didn't work either. So I moved to writing a service command for performing the stop action for the selected roles. 

1. How would I know which roles are selected? How can I track it in the control.sh?

2. Is there a better way to stop a role individually in a CSD?

 

Your input is much appreciated. Thanks in advance.

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Stopping selected roles from Service action menu in a CSD

Thanks for this report!

This does indeed appear to be a bug (Paolo dug into it internally, credit to him) and we'll get a fix out in a future release.

The abruptly stop step should skip when there's no started roles, rather than error.

Thanks,
Darren
7 REPLIES 7

Re: Stopping selected roles from Service action menu in a CSD

Hi,

Custom stop runners at the role level are planned for a future release. Stay tuned!

Until then, the only ways to stop roles are:
1) Standard stop, included by default. CM will basically send a sigterm to your process, and if it doesn't die after 30s, it will send a group sigkill. You can stop individual roles this way (select what you want on the instances page, chose Actions for Selected -> Stop), but there's no reasonable way to run a custom stop script.
2) Service-level graceful stop. CM will run a custom script on a master role in your service, which must instruct the workers to exit normally (exit code 0), and once those have exited, CM will consider the service-level stop command successful. This is only helpful if your master role can orchestrate the stop, and it'll always stop all roles.

Thanks,
Darren

Re: Stopping selected roles from Service action menu in a CSD

New Contributor

Thank you very much Darren. That clarifies my question on the Stop action.

 

1. I performed a service-level stop to stop all my roles, it is killing all my processes and an exit 0 is appearing, however, I am getting an "Abruptly stop the remaining roles" (in my step 2/2 of the Gracefully stop the service) which fails because there aren't any more remaining roles.

How can I prevent the "Abruptly stop the remaining roles" being called? Will the framework always call this or when would it call the same? Would you please point out where I am going wrong?

 

2. If I were to write a custom service command for the CSD, is there a way to get the roles selected (Service -> instances -> actions for selected menu)  that should execute the command, in the control script?

 

 

Re: Stopping selected roles from Service action menu in a CSD

1. You can't prevent the abrupt stop, but you shouldn't need to. Is it actually causing a problem? It may just be skipped. Can you show any error message, or post a screen shot?

2. No, that's not possible.

Re: Stopping selected roles from Service action menu in a CSD

New Contributor

Hi Darren,

Thank you very much for a quick response.

Please find attached the screenshot displaying the error. The error says
"atleast one role must be started".
I had to write a custom stopRunner for the service as the roles were used
to start a spark job which escapes the Cloudera Manager's stop action.
sc.png
Please let me know how I could fix this or if I can skip the "abruptly
stop".

Thank you.
Regards,
Chandni Shankar

Re: Stopping selected roles from Service action menu in a CSD

Thanks for this report!

This does indeed appear to be a bug (Paolo dug into it internally, credit to him) and we'll get a fix out in a future release.

The abruptly stop step should skip when there's no started roles, rather than error.

Thanks,
Darren

Re: Stopping selected roles from Service action menu in a CSD

New Contributor

Thank you for all the input! :)

 

 

Re: Stopping selected roles from Service action menu in a CSD

New Contributor

Hi @Darren,

Is this fix delivered to CDH 6.2, I am facing this issue in 6.2.

The custom stopRunner is not invoked when I stop the service via CM.

 

BR/ Srikanth

Don't have an account?
Coming from Hortonworks? Activate your account here