Example #1
0
 def status(self, app_name):
     # Attempt to find the status of a given app by finding where that apps
     # pid file is and loading said pids details (from stderr/stdout) files
     # that should exist as well as by using shell utilities to determine
     # if said pid is still running...
     trace_dir = self.runtime.get_option('trace_dir')
     if not sh.isdir(trace_dir):
         return (STATUS_UNKNOWN, '')
     fork_fns = self._form_file_names(app_name)
     pid = fork_fns.extract_pid()
     stderr = ''
     try:
         stderr = sh.load_file(fork_fns.stderr)
     except (IOError, ValueError, TypeError):
         pass
     stdout = ''
     try:
         stdout = sh.load_file(fork_fns.stdout)
     except (IOError, ValueError, TypeError):
         pass
     details = {
         'STDOUT': stdout,
         'STDERR': stderr,
     }
     if pid is not None and sh.is_running(pid):
         return (STATUS_STARTED, details)
     else:
         return (STATUS_UNKNOWN, details)
 def status(self, app_name):
     trace_dir = self.runtime.get_option('trace_dir')
     if not sh.isdir(trace_dir):
         return constants.STATUS_UNKNOWN
     (pid_file, stderr_fn, stdout_fn) = self._form_file_names(FORK_TEMPL % (app_name))
     pid = self._extract_pid(pid_file)
     if pid and sh.is_running(pid):
         return constants.STATUS_STARTED
     else:
         return constants.STATUS_UNKNOWN
Example #3
0
 def status(self, app_name):
     trace_dir = self.runtime.get_option('trace_dir')
     if not sh.isdir(trace_dir):
         return (STATUS_UNKNOWN, '')
     (pid_file, stderr_fn, stdout_fn) = self._form_file_names(FORK_TEMPL % (app_name))
     pid = self._extract_pid(pid_file)
     stderr = ''
     try:
         stderr = sh.load_file(stderr_fn)
     except IOError:
         pass
     stdout = ''
     try:
         stdout = sh.load_file(stdout_fn)
     except IOError:
         pass
     if pid and sh.is_running(pid):
         return (STATUS_STARTED, (stdout + stderr).strip())
     else:
         return (STATUS_UNKNOWN, (stdout + stderr).strip())