You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by xi...@sky-data.cn on 2018/03/29 12:14:47 UTC

custom master service can not stop

Hi! 

I add a master service as below: 

<schemaVersion>2.0</schemaVersion> 
<services> 
<service> 
<name>YUM</name> 
<displayName>YUM</displayName> 
<comment>Yum Service</comment> 
<version>1.0.0</version> 
<components> 
<component> 
<name>YUM_MASTER</name> 
<displayName>Yum Master</displayName> 
<category>MASTER</category> 
<cardinality>1</cardinality> 
<commandScript> 
<script>scripts/master.py</script> 
<scriptType>PYTHON</scriptType> 
<timeout>600</timeout> 
</commandScript> 
</component> 
<component> 
<name>YUM_SLAVE</name> 
<displayName>Yum Slave</displayName> 
<category>SLAVE</category> 
<cardinality>1+</cardinality> 
<commandScript> 
<script>scripts/slave.py</script> 
<scriptType>PYTHON</scriptType> 
<timeout>600</timeout> 
</commandScript> 
</component> 
</components> 
<osSpecifics> 
<osSpecific> 
<osFamily>any</osFamily> 
</osSpecific> 
</osSpecifics> 
</service> 
</services> 
</metainfo> 

master.py: 

class Master(Script): 
def install(self, env): 
print 'Install Yum' 

def start(self, env): 
print 'Start Yum' 

def stop(self, env): 
print 'Stop Yum' 

def status(self, env): 
print 'Test Yum' 

if __name__ == "__main__": 
Master().execute() 

slave.py: 

class Slave(Script): 
def install(self, env): 
print 'Wait for Yum_Master install finish...' 

def start(self, env): 
print 'Wait for Yum_Master install finish...' 

def stop(self, env): 
print 'Wait for Yum_Master stop finish...' 

def status(self, env): 
print 'Wait for Yum_Master test finish...' 

if __name__ == "__main__": 
Slave().execute() 

I install it successfully, but when stop on the web UI, the master can not stop: 

Test Yum 
Test Yum 
Test Yum 
Test Yum 
Test Yum 
Test Yum 
Test Yum 
Test Yum 
Test Yum 
2018-03-29 19:12:54,068 - Waiting for actual component stop 

It hang at 35%. 

I follow https://cwiki.apache.org/confluence/display/AMBARI/Defining+a+Custom+Service, did i miss something import? 

Best wishes 

Re: custom master service can not stop

Posted by Di Li <os...@gmail.com>.
Not much to go with based on your example, as I assume you removed
sensitive code that actually does the stop. All I can suggest is to make
sure the stop actually stops the process and don't sit in a loop forever.
Also, it's not the stop that tells the UI a component is "stopped" or not,
it's the status call.

On Thu, Mar 29, 2018 at 8:33 AM, <xi...@sky-data.cn> wrote:

> After waiting about 1 hour, it always print log as below and failed
> finally:
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> 2018-03-29 20:15:35,835 - Waiting for actual component stop
>
> ----- Original Message -----
> From: "xiang dai" <xi...@sky-data.cn>
> To: dev@ambari.apache.org
> Sent: Thursday, March 29, 2018 8:14:47 PM
> Subject: custom master service can not stop
>
> Hi!
>
> I add a master service as below:
>
> <schemaVersion>2.0</schemaVersion>
> <services>
> <service>
> <name>YUM</name>
> <displayName>YUM</displayName>
> <comment>Yum Service</comment>
> <version>1.0.0</version>
> <components>
> <component>
> <name>YUM_MASTER</name>
> <displayName>Yum Master</displayName>
> <category>MASTER</category>
> <cardinality>1</cardinality>
> <commandScript>
> <script>scripts/master.py</script>
> <scriptType>PYTHON</scriptType>
> <timeout>600</timeout>
> </commandScript>
> </component>
> <component>
> <name>YUM_SLAVE</name>
> <displayName>Yum Slave</displayName>
> <category>SLAVE</category>
> <cardinality>1+</cardinality>
> <commandScript>
> <script>scripts/slave.py</script>
> <scriptType>PYTHON</scriptType>
> <timeout>600</timeout>
> </commandScript>
> </component>
> </components>
> <osSpecifics>
> <osSpecific>
> <osFamily>any</osFamily>
> </osSpecific>
> </osSpecifics>
> </service>
> </services>
> </metainfo>
>
> master.py:
>
> class Master(Script):
> def install(self, env):
> print 'Install Yum'
>
> def start(self, env):
> print 'Start Yum'
>
> def stop(self, env):
> print 'Stop Yum'
>
> def status(self, env):
> print 'Test Yum'
>
> if __name__ == "__main__":
> Master().execute()
>
> slave.py:
>
> class Slave(Script):
> def install(self, env):
> print 'Wait for Yum_Master install finish...'
>
> def start(self, env):
> print 'Wait for Yum_Master install finish...'
>
> def stop(self, env):
> print 'Wait for Yum_Master stop finish...'
>
> def status(self, env):
> print 'Wait for Yum_Master test finish...'
>
> if __name__ == "__main__":
> Slave().execute()
>
> I install it successfully, but when stop on the web UI, the master can not
> stop:
>
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> Test Yum
> 2018-03-29 19:12:54,068 - Waiting for actual component stop
>
> It hang at 35%.
>
> I follow https://cwiki.apache.org/confluence/display/AMBARI/
> Defining+a+Custom+Service, did i miss something import?
>
> Best wishes
>

Re: custom master service can not stop

Posted by xi...@sky-data.cn.
After waiting about 1 hour, it always print log as below and failed finally:
Test Yum
Test Yum
Test Yum
Test Yum
Test Yum
Test Yum
Test Yum
Test Yum
Test Yum
Test Yum
Test Yum
Test Yum
Test Yum
Test Yum
Test Yum
Test Yum
Test Yum
Test Yum
Test Yum
Test Yum
Test Yum
Test Yum
Test Yum
Test Yum
Test Yum
Test Yum
Test Yum
Test Yum
2018-03-29 20:15:35,835 - Waiting for actual component stop

----- Original Message -----
From: "xiang dai" <xi...@sky-data.cn>
To: dev@ambari.apache.org
Sent: Thursday, March 29, 2018 8:14:47 PM
Subject: custom master service can not stop

Hi! 

I add a master service as below: 

<schemaVersion>2.0</schemaVersion> 
<services> 
<service> 
<name>YUM</name> 
<displayName>YUM</displayName> 
<comment>Yum Service</comment> 
<version>1.0.0</version> 
<components> 
<component> 
<name>YUM_MASTER</name> 
<displayName>Yum Master</displayName> 
<category>MASTER</category> 
<cardinality>1</cardinality> 
<commandScript> 
<script>scripts/master.py</script> 
<scriptType>PYTHON</scriptType> 
<timeout>600</timeout> 
</commandScript> 
</component> 
<component> 
<name>YUM_SLAVE</name> 
<displayName>Yum Slave</displayName> 
<category>SLAVE</category> 
<cardinality>1+</cardinality> 
<commandScript> 
<script>scripts/slave.py</script> 
<scriptType>PYTHON</scriptType> 
<timeout>600</timeout> 
</commandScript> 
</component> 
</components> 
<osSpecifics> 
<osSpecific> 
<osFamily>any</osFamily> 
</osSpecific> 
</osSpecifics> 
</service> 
</services> 
</metainfo> 

master.py: 

class Master(Script): 
def install(self, env): 
print 'Install Yum' 

def start(self, env): 
print 'Start Yum' 

def stop(self, env): 
print 'Stop Yum' 

def status(self, env): 
print 'Test Yum' 

if __name__ == "__main__": 
Master().execute() 

slave.py: 

class Slave(Script): 
def install(self, env): 
print 'Wait for Yum_Master install finish...' 

def start(self, env): 
print 'Wait for Yum_Master install finish...' 

def stop(self, env): 
print 'Wait for Yum_Master stop finish...' 

def status(self, env): 
print 'Wait for Yum_Master test finish...' 

if __name__ == "__main__": 
Slave().execute() 

I install it successfully, but when stop on the web UI, the master can not stop: 

Test Yum 
Test Yum 
Test Yum 
Test Yum 
Test Yum 
Test Yum 
Test Yum 
Test Yum 
Test Yum 
2018-03-29 19:12:54,068 - Waiting for actual component stop 

It hang at 35%. 

I follow https://cwiki.apache.org/confluence/display/AMBARI/Defining+a+Custom+Service, did i miss something import? 

Best wishes