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
|