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" <[email protected]>
To: [email protected]
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

Reply via email to