Determine the status of the daemon
976828
def status(self):
        """"""
        my_name = os.path.basename(sys.argv[0])
        if self._already_running():
            message = "{0} (pid  {1}) is running...\n".format(my_name, self.pid)
            sys.stdout.write(message)
            return 0
        sys.stdout.write("{0} is stopped\n".format(my_name))
        return 3
100466
def is_running(self, submissionid, user_check=True):
        
        submission = self.get_submission(submissionid, user_check)
        return submission["status"] == "waiting"
1352113
function(isnodeObj){
		if(initialised)
			return ismod;
		isnode = isnodeObj;
		log = isnode.module("logger").log;
		isnode.on("startDaemon", function(){
			if(!process.send) {
				run({name: isnode.pkg().name, isChildProcess: process.send});
			} else {
				log("fatal", "Daemon Initiated, but running in daemon mode. Terminating application.");
			}
		});
		isnode.on("shutdown", function(){ shutdown(); });
		initialised = true;
		return ismod;
	}
242115
def _check_status(self):
        """"""
        logger.info('Checking repo status')
        status = self.log_call(
            ['git', 'status', '--porcelain'],
            callwith=subprocess.check_output,
            cwd=self.cwd,
        )
        if status:
            raise DirtyException(status)
565424
def is_running(pid):
    
    process = get_process(pid)
    if process and process.is_running() and process.status() != "zombie":
        return True
    else:
        return False
737848
def _systemctl_status(name):
    '''
    
    '''
    contextkey = 'systemd._systemctl_status.%s' % name
    if contextkey in __context__:
        return __context__[contextkey]
    __context__[contextkey] = __salt__['cmd.run_all'](
        _systemctl_cmd('status', name),
        python_shell=False,
        redirect_stderr=True,
        ignore_retcode=True
    )
    return __context__[contextkey]
1050261
def _StatusUpdateThreadMain(self):
    """"""
    while self._status_update_active:
      # Make a local copy of the PIDs in case the dict is changed by
      # the main thread.
      for pid in list(self._process_information_per_pid.keys()):
        self._CheckStatusWorkerProcess(pid)

      self._UpdateForemanProcessStatus()

      tasks_status = self._task_manager.GetStatusInformation()
      if self._task_queue_profiler:
        self._task_queue_profiler.Sample(tasks_status)

      self._processing_status.UpdateTasksStatus(tasks_status)

      if self._status_update_callback:
        self._status_update_callback(self._processing_status)

      time.sleep(self._STATUS_UPDATE_INTERVAL)
1113644
def do_status(self, _):
        '''  '''
        server_status = self.server.is_server_running()
        if server_status == 'yes':
            print 'Server: ' + colorize('currently online', 'green')
        elif server_status == 'no':
            print 'Server: ' + colorize('currently offline', 'red')
        elif server_status == 'maybe':
            print 'Server: ' + colorize('status unknown', 'yellow')
        elif server_status == 'blocked':
            print 'Server: ' + colorize('blocked', 'red')
727933
def is_running(self):
        
        try:
            return graceful_get(self.inspect(refresh=True), "State", "Running")
        except subprocess.CalledProcessError:
            return False
115314
function() {

    // Automatically return true if we are in the GUI and on linux because
    // this requires SUDO and because the daemon should always be running on nix
    if (mode === 'gui' && process.platform === 'linux') {
      return Promise.resolve(true);
    }

    // Get status
    return isDown()

    // Only start if we aren't already
    .then(function(isDown) {
      if (isDown) {
        var opts = (process.platform === 'win32') ? {detached: true} : {};
        return serviceCmd(['start'], opts);
      }
    })

    // Wait for the daemon to respond
    .retry(function() {
      log.debug('Trying to connect to daemon.');
      return bin.sh([DOCKER_EXECUTABLE, 'info'], {mode: 'collect'});
    }, {max: 25, backoff: 1000})

    // Wrap errors.
    .catch(function(err) {
      throw new VError(err, 'Error bringing daemon up.');
    });

  }
480529
def verify_system_status(self):
        """"""
        if not sys.platform.startswith('linux'):
            raise InstallError('Supported platform is Linux only.')

        if self.python.is_system_python():
            if self.python.is_python_binding_installed():
                message = '''
RPM Python binding already installed on system Python.
Nothing to do.
'''
                Log.info(message)
                raise InstallSkipError(message)
            elif self.sys_installed:
                pass
            else:
                message = '''
RPM Python binding on system Python should be installed manually.
Install the proper RPM package of python{,2,3}-rpm,
or set a environment variable RPM_PY_SYS=true
'''
                raise InstallError(message)

        if self.rpm.is_system_rpm():
            self.verify_package_status()
803413
def status(self):
        
        if not self.created:
            return None
        self.inner().reload()
        return self.inner().status
401543
def status(self):
        """"""
        # If there is no script it is either ready or a lost duplicate #
        if not self.script_path.exists:
            if self.name in     jobs.names: return "DUPLICATE"
            if self.name not in jobs.names: return "READY"
        # It is submitted already #
        if self.name in jobs.names:
            if jobs[self.name]['type'] == 'queued':  return "QUEUED"
            if jobs[self.name]['type'] == 'running': return "RUNNING"
        # So the script exists for sure but it is not in the queue #
        if not self.kwargs['out_file'].exists: return "ABORTED"
        # Let's look in log file #
        if 'CANCELED'          in self.log_tail: return "CANCELLED"
        if 'slurmstepd: error' in self.log_tail: return "CANCELLED"
        # It all looks good #
        if 'SLURM: end at'     in self.log_tail: return "FINISHED"
        # At this point we have no idea #
        return "INTERUPTED"
297106
def status():
    '''
    
    '''
    puppet = _Puppet()

    if os.path.isfile(puppet.disabled_lockfile):
        return 'Administratively disabled'

    if os.path.isfile(puppet.run_lockfile):
        try:
            with salt.utils.files.fopen(puppet.run_lockfile, 'r') as fp_:
                pid = int(salt.utils.stringutils.to_unicode(fp_.read()))
                os.kill(pid, 0)  # raise an OSError if process doesn't exist
        except (OSError, ValueError):
            return 'Stale lockfile'
        else:
            return 'Applying a catalog'

    if os.path.isfile(puppet.agent_pidfile):
        try:
            with salt.utils.files.fopen(puppet.agent_pidfile, 'r') as fp_:
                pid = int(salt.utils.stringutils.to_unicode(fp_.read()))
                os.kill(pid, 0)  # raise an OSError if process doesn't exist
        except (OSError, ValueError):
            return 'Stale pidfile'
        else:
            return 'Idle daemon'

    return 'Stopped'
1037010
def monitoring_problems(self):
        
        if self.app.type != 'scheduler':
            return {'_status': u'ERR',
                    '_message': u"This service is only available for a scheduler daemon"}

        res = self.identity()
        res.update(self.app.get_monitoring_problems())
        return res
29639
def status(name, sig=None):
    '''
    
    '''

    proxy_fn = 'dummy.service_status'
    resp = __proxy__[proxy_fn](name)
    if resp['comment'] == 'stopped':
        return False
    if resp['comment'] == 'running':
        return True
1224285
def get_device_status(self, t):
        ''''''
        data = {}
        for name, (func, _, _) in self.addons.iteritems():
            data[name] = func(t)
        return data