Exemplo n.º 1
0
 def test_status_from_nosuch_name(self, quite=0):
     if not quite: self.progress_message("\ntest_status_from_nosuch_name:")
     status = process.status_from_name('test')
     if status.name != 'test':
         raise 'Did not set the name correctly.'
     if status.pid != None:
         raise 'Found nonexistant named process id.'
     if status.state != process.StatusEnum.DOESNOTEXIST:
         raise 'Found nonexistant named process state.'
     return
Exemplo n.º 2
0
 def test_status_from_name(self, quite=0):
     if not quite: self.progress_message("\ntest_status_from_name:")
     process.register_named_process('test', os.getpid())
     status = process.status_from_name('test')
     if status.name != 'test':
         raise 'Did not set the name correctly.'
     if status.pid != os.getpid():
         raise 'Self does not have my process id.'
     if status.state != process.StatusEnum.EXISTS:
         raise 'Self does not EXIST, using status_from_name.'
     return
Exemplo n.º 3
0
 def test_status_from_nosuch_name(self, quite=0):
     if not quite:
         self.progress_message("\ntest_status_from_nosuch_name:")
     status = process.status_from_name("test")
     if status.name != "test":
         raise "Did not set the name correctly."
     if status.pid != None:
         raise "Found nonexistant named process id."
     if status.state != process.StatusEnum.DOESNOTEXIST:
         raise "Found nonexistant named process state."
     return
Exemplo n.º 4
0
    def do_status(self):
        status = process.status_from_name("broadway").state

        if status == "EXISTS":
            status = "OK"
        elif status == "DOESNOTEXIST":
            status = "Application not running"
        else:
            status = "Offline: " + status

        return status
Exemplo n.º 5
0
 def do_status(self):
     status = process.status_from_name('broadway').state
     
     if status == 'EXISTS':
         status = 'OK'
     elif status == 'DOESNOTEXIST':
         status = 'Application not running'
     else:
         status = 'Offline: ' + status
         
     return status
Exemplo n.º 6
0
 def test_status_from_name(self, quite=0):
     if not quite:
         self.progress_message("\ntest_status_from_name:")
     process.register_named_process("test", os.getpid())
     status = process.status_from_name("test")
     if status.name != "test":
         raise "Did not set the name correctly."
     if status.pid != os.getpid():
         raise "Self does not have my process id."
     if status.state != process.StatusEnum.EXISTS:
         raise "Self does not EXIST, using status_from_name."
     return
Exemplo n.º 7
0
 def test_terminate_named_process(self, quite=0):
     if not quite: self.progress_message("\ntest_terminate_named_process:")
     child = popen2.Popen4('bash -c "while true; do sleep 1; done"')
     process.register_named_process('child', child.pid)
     status = process.status_from_name('child')
     if status.name != 'child':
         raise 'Did not set the name correctly.'
     if status.pid != child.pid:
         raise 'Child does not have the correct pid.'
     if status.state != process.StatusEnum.EXISTS:
         raise 'Child does not EXIST.'
     exit_status = process.terminate_named_process('child')
     return
Exemplo n.º 8
0
 def test_terminate_named_process(self, quite=0):
     if not quite:
         self.progress_message("\ntest_terminate_named_process:")
     child = popen2.Popen4('bash -c "while true; do sleep 1; done"')
     process.register_named_process("child", child.pid)
     status = process.status_from_name("child")
     if status.name != "child":
         raise "Did not set the name correctly."
     if status.pid != child.pid:
         raise "Child does not have the correct pid."
     if status.state != process.StatusEnum.EXISTS:
         raise "Child does not EXIST."
     exit_status = process.terminate_named_process("child")
     return