Returns True if the maintenance worker should be run now,
        and False otherwise.
        :return:
960469
def check_for_maintenance(self):
        '''
        
        '''
        numrevs = self.conn.get_one("SELECT count(revnum) FROM csetLog")[0]
        if numrevs >= SIGNAL_MAINTENACE_CSETS:
            return True
        return False
336128
public boolean needsRefresh() {
        boolean needsRefresh;

        this.refreshLock.readLock().lock();
        long now = System.currentTimeMillis();
        long tokenDuration = (now - this.lastRefresh);
        needsRefresh = (tokenDuration >= this.expires - REFRESH_EPSILON);
        this.refreshLock.readLock().unlock();

        return needsRefresh;
    }
971077
def _ensure_worker(self):
        """"""
        while len(self._workers) < self._min_workers or len(self._workers) < self._queue.qsize() < self._max_workers:
            worker = threading.Thread(
                target=self._execute_futures,
                name=self.identifier + '_%d' % time.time(),
            )
            worker.daemon = True
            self._workers.add(worker)
            worker.start()
695693
def is_updated(self):
        

        if not self.is_published:
            return False

        return sanitize_date(self.sys['published_at']) < sanitize_date(self.sys['updated_at'])
820943
def is_running(self):
        
        if self.block:
            return False

        return self.thread.is_alive() or self.process.poll() is None
112680
def has_running_jobs(self) -> bool:
        """""""
        return self.jobs.exclude(status__status__in=ExperimentLifeCycle.DONE_STATUS).exists()
267220
def run(self):
        
        if self.update_time_value():
            self.i3status.py3_wrapper.notify_update(self.module_name)
        due_time = self.py3.time_in(sync_to=self.time_delta)

        self.i3status.py3_wrapper.timeout_queue_add(self, due_time)
617601
def needs_fixity_check?(latest_fixity_check)
        return true unless latest_fixity_check
        unless latest_fixity_check.updated_at
          logger.warn "***FIXITY*** problem with fixity check log! Latest Fixity check is not nil, but updated_at is not set #{latest_fixity_check}"
          return true
        end
        days_since_last_fixity_check(latest_fixity_check) >= max_days_between_fixity_checks
      end
432079
def ready(self):
        
        logger = self.get_logger()
        now = current_ts()
        logger.trace("Current time: {0}".format(now))
        logger.trace("Last Run: {0}".format(self._last_run))
        delta = (now - self._last_run)
        logger.trace("Delta: {0}, Interval: {1}"
                     .format(delta, self.interval * 1000))
        return delta > self.interval * 1000
1087172
def running?
      total_jobs_running = get_jobs_by_status(Executor::STATUS_NONE).size +
                           get_jobs_by_status(Executor::STATUS_RUNNING).size +
                           get_jobs_by_status(Executor::STATUS_RETRYING).size
      (total_jobs_running > 0)
    end
523360
def has_update(self):
        
        _time = time
        if _time() > self.next_update:
            self.update_data()
            self.next_update = _time() + self.interval
            return True
        return False
193425
def update_status(self):
        
        # this function should be part of the server

        if (self.status is not None) and self.status > 0:
            # status is already final
            return False

        old_status = self.status
       
        job_dir = self.run_dir + os.sep + self.id

        if os.path.isfile(run_dir + os.sep + 'FAILURE'):
            self.status = self.FAILED
        elif os.path.isfile(run_dir + os.sep + 'FINISHED'):
            self.status = self.FINISHED
        else:
            self.status = self.RUNNING

        if self.status != old_status:
            return True
        else:
            return False
372248
def is_current_manager_equals_to(cls, pm):
        """"""
        if hasattr(cls, 'works_result'):
            return cls.works_result
        is_ok = bool(cls._try_get_current_manager() == pm)
        setattr(cls, 'works_result', is_ok)
        return is_ok
740616
def _IsCronJobFailing(self, cron_job):
    """"""
    status = cron_job.Get(cron_job.Schema.LAST_RUN_STATUS)
    if status is None:
      return False

    return status.status != rdf_cronjobs.CronJobRunStatus.Status.OK
1089918
def update(self, timedelta, *args, **kwargs):
        

        # TODO move time management somewhere else...
        self.last_update += timedelta
        # if shutdown we want to bypass the update_interval check
        # if shutting_down:
        #     self.interface.update(shutting_down=shutting_down)
        #     return 0  # return 0 as success since we arrived here without exception
        # else
        if self.last_update > self.update_interval:
            self.last_update = 0
            self.interface.update()
459517
def isUpdated(self):
        
        modified_time = self.getmtime()
        valid = modified_time > self.__stamp
        return valid
805638
def check_if_ok_to_update(self):
        """"""
        current_time = int(time.time())
        last_refresh = self.last_refresh
        if last_refresh is None:
            last_refresh = 0
        if current_time >= (last_refresh + self.refresh_rate):
            return True
        return False