Support Questions

Find answers, ask questions, and share your expertise

Parallel Task Execution in Ambari on the Sandbox

avatar
Expert Contributor

I'm currently trying to turn this demo into an Ambari service to start/stop/install the demo services. All of my testing is on the last release of the HDP 2.4 Sandbox

https://github.com/vakshorton/DeviceManagerDemo

I've turned it into an Ambari service in this fork:

https://github.com/ZacBlanco/DeviceManagerDemo

My issue I'm having is that the original installation script makes calls to the Ambari API. This in turns triggers tasks such as Start/Stop/Restart of other Ambari services. But when the install script is run by the Ambari Agent, the current task running is the install of DEMOSERVICE. The agent refuses to run the other Ambari tasks that are created by the install script. Thus the script never actually finishes installing because it’s waiting for Ambari to finish the task - which is never does.

I have enabled the parallel_execution=1 in /etc/ambari-agent/conf/ambari-agent.ini ( https://issues.apache.org/jira/browse/AMBARI-8189)

Is there a way to get Ambari to run the tasks in parallel? Or does anyone know of a workaround for this?

The install script is here:

https://github.com/ZacBlanco/DeviceManagerDemo/blob/master/package/files/install.sh

1 ACCEPTED SOLUTION

avatar

@zblanco I had run into same issues with trucking demo service. Once the cluster is up you can't really have one service start up another (e.g. Storm depends on Zookeeper. But if Zookeeper is down, starting storm will not start zookeeper automatically).

Best you can do is to declare start dependencies for your components so that when user clicks "Start all services" (or does fresh install), the components are started in the right order (e.g. zookeeper first then storm then trucking demo). To do this you would need to modify the role_command_order.json where these dependencies are managed. Note that in Ambari 2.2 and earlier this was defined at the stack level (e.g. /var/lib/ambari-server/resources/stacks/HDP/<version>/role_command_order.json) so you could not override it from within your service code. But in Ambari 2.3 onwards you can override this at the service level itself (see AMBARI-9363)

Simple example of how to do this can be seen in the instructions for doing fresh install of demo Solr service, where we are asking user to modify this file prior to install to declare a dependency of Solr on zookeeper (to ensure Solr is started after zookeeper during install):

https://github.com/abajwa-hw/solr-stack#option-2-automated-deployment-of-fresh-cluster-via-blueprint

Long story short: best option is to update the role_command_order.json, (restart ambari-server) and then have end users use "Start all" to start components in correct order (note: if you don't want to start a specific service, stop it and put it in maintenance mode and it should remain down)

View solution in original post

3 REPLIES 3

avatar

@zblanco I had run into same issues with trucking demo service. Once the cluster is up you can't really have one service start up another (e.g. Storm depends on Zookeeper. But if Zookeeper is down, starting storm will not start zookeeper automatically).

Best you can do is to declare start dependencies for your components so that when user clicks "Start all services" (or does fresh install), the components are started in the right order (e.g. zookeeper first then storm then trucking demo). To do this you would need to modify the role_command_order.json where these dependencies are managed. Note that in Ambari 2.2 and earlier this was defined at the stack level (e.g. /var/lib/ambari-server/resources/stacks/HDP/<version>/role_command_order.json) so you could not override it from within your service code. But in Ambari 2.3 onwards you can override this at the service level itself (see AMBARI-9363)

Simple example of how to do this can be seen in the instructions for doing fresh install of demo Solr service, where we are asking user to modify this file prior to install to declare a dependency of Solr on zookeeper (to ensure Solr is started after zookeeper during install):

https://github.com/abajwa-hw/solr-stack#option-2-automated-deployment-of-fresh-cluster-via-blueprint

Long story short: best option is to update the role_command_order.json, (restart ambari-server) and then have end users use "Start all" to start components in correct order (note: if you don't want to start a specific service, stop it and put it in maintenance mode and it should remain down)

avatar
Expert Contributor

Thanks! Do you have any comment on the parallel task execution? Or have you dealt with it before? I'm just curious.

avatar

@zblanco actually no...wasn't aware of it until you pointed it out