Check whether a job is running for too long or not.

@return true if the is running for too long, else false.
Returned value is made available for testing purposes.
9148
boolean detectLongRunningJob(long currentTime, Job job) {
		if(job.status() == JobStatus.RUNNING && !longRunningJobs.containsKey(job)) {
			int jobExecutionsCount = job.executionsCount();
			Long jobStartedtimeInMillis = job.lastExecutionStartedTimeInMillis();
			Thread threadRunningJob = job.threadRunningJob();

			if(jobStartedtimeInMillis != null
				&& threadRunningJob != null
				&& currentTime - jobStartedtimeInMillis > detectionThresholdInMillis) {
				logger.warn(
					"Job '{}' is still running after {}ms (detection threshold = {}ms), stack trace = {}",
					job.name(),
					currentTime - jobStartedtimeInMillis,
					detectionThresholdInMillis,
					Stream
						.of(threadRunningJob.getStackTrace())
						.map(StackTraceElement::toString)
						.collect(Collectors.joining("\n  "))
				);

				longRunningJobs.put(
					job,
					new LongRunningJobInfo(jobStartedtimeInMillis, jobExecutionsCount)
				);

				return true;
			}
		}
		return false;
	}
299682
public boolean trySaveToBean() {

        try {
            m_group.commit();
        } catch (Exception e) {
            LOG.info(e.getLocalizedMessage(), e);
            return false;
        }
        m_job.setParameters(readParams());
        return true;
    }
1046156
Long cleanUpLongJobIfItHasFinishedExecuting(long currentTime, Job job) {
		if(longRunningJobs.containsKey(job)
			&& longRunningJobs.get(job).executionsCount != job.executionsCount()) {
			Long jobLastExecutionTimeInMillis = job.lastExecutionEndedTimeInMillis();
			int jobExecutionsCount = job.executionsCount();
			LongRunningJobInfo jobRunningInfo = longRunningJobs.get(job);

			long jobExecutionDuration = 0L;
			if(jobExecutionsCount == jobRunningInfo.executionsCount + 1) {
				jobExecutionDuration = jobLastExecutionTimeInMillis - jobRunningInfo.jobStartedtimeInMillis;
				logger.info(
					"Job '{}' has finished executing after {}ms",
					job.name(),
					jobExecutionDuration
				);
			} else {
				jobExecutionDuration = currentTime - jobRunningInfo.jobStartedtimeInMillis;
				logger.info(
					"Job '{}' has finished executing after about {}ms",
					job.name(),
					jobExecutionDuration
				);
			}

			longRunningJobs.remove(job);
			return jobExecutionDuration;
		}

		return null;
	}
108921
public boolean isRunning()
  {
    if (tc.isEntryEnabled())
    {
      SibTr.entry(tc, "isRunning");
      SibTr.exit(tc, "isRunning", new Boolean(_isRunning));
    }
    
    return _isRunning;
  }
535257
public static boolean runJob(JobConf job) throws IOException {
    JobClient jc = new JobClient(job);
    boolean sucess = true;
    RunningJob running = null;
    try {
      running = jc.submitJob(job);
      JobID jobId = running.getID();
      System.out.println("Job " + jobId + " is submitted");
      while (!running.isComplete()) {
        System.out.println("Job " + jobId + " is still running.");
        try {
          Thread.sleep(60000);
        } catch (InterruptedException e) {
        }
        running = jc.getJob(jobId);
      }
      sucess = running.isSuccessful();
    } finally {
      if (!sucess && (running != null)) {
        running.killJob();
      }
      jc.close();
    }
    return sucess;
  }
951264
private static boolean isLong( Number n ) {
      if( n instanceof Long ){
         return true;
      }
      try{
         Long.parseLong( String.valueOf( n ) );
         return true;
      }catch( NumberFormatException e ){
         return false;
      }
   }
1053154
public boolean isRunning(int attempts, long timeout, TimeUnit timeUnit) {
        try {
            HttpResponse httpResponse = sendRequest(request().withMethod("PUT").withPath(calculatePath("status")));
            if (httpResponse.getStatusCode() == HttpStatusCode.OK_200.code()) {
                return true;
            } else if (attempts == 0) {
                return false;
            } else {
                try {
                    timeUnit.sleep(timeout);
                } catch (InterruptedException e) {
                    // ignore interrupted exception
                }
                return isRunning(attempts - 1, timeout, timeUnit);
            }
        } catch (SocketConnectionException sce) {
            return false;
        }
    }
527203
protected function checkRuntime()
    {
        // Check Runtime.
        if ($this->timer < time()) {
            // This is taking longer than expected.
            $this->pool->messages->addMessage('emergencyTimer');
            Krexx::editSettings();
            Krexx::disable();
            static::$allIsOk = false;
            return true;
        }

        return false;
    }
204522
public static boolean isLong(String s) {
        if (s == null) {
            return false;
        }
        try {
            Long.parseLong(s.trim());
        } catch (NumberFormatException e) {
            return false;
        }
        return true;
    }
406891
public boolean isBusy() {
        lock.readLock().lock();
        try {
            return workUnit != null || executable != null;
        } finally {
            lock.readLock().unlock();
        }
    }
76644
def check(self):
        '''  '''
        if self.lastrun + self.interval < time.time():
            return True
        else:
            return False
977236
public boolean isSet() {
        if (isUsageMode()) {
            return true;
        }
        if (getJobFile() != null) {
            return true;
        }
        if (getListType() != null) {
            return true;
        }
        return false;
    }
1024228
protected boolean isExpiredAt(long time) {
        try (Lock ignored = locker.lockIfNotHeld()) {
            checkValidForRead();
            return sessionData.isExpiredAt(time);
        }
    }
36158
private boolean incSlotLimit(JobInfo info, TaskType type, LimitType limit) {
    switch (limit) {
      case MIN:
        if (type == TaskType.MAP) {
          if (info.minMaps < runnableTasks(info, type)) {
            info.minMaps += 1;
            return true;
          }
        } else {
          if (info.minReduces < runnableTasks(info, type)) {
            info.minReduces += 1;
            return true;
          }
        }
        return false;
      case MAX:
        if (type == TaskType.MAP) {
          if (info.maxMaps < runnableTasks(info, type)) {
            info.maxMaps += 1;
            return true;
          }
        } else {
          if (info.maxReduces < runnableTasks(info, type)) {
            info.maxReduces += 1;
            return true;
          }
        }
        return false;
    }
    // Never come here
    return false;
  }
1346353
public boolean isRuntimeGroovydocEnabled() {
        Boolean runtimeGroovydocEnabled = this.getOptimizationOptions().get(RUNTIME_GROOVYDOC);

        if (null == runtimeGroovydocEnabled) {
            return false;
        }

        return runtimeGroovydocEnabled;
    }
181761
def reissueOverLongJobs(self):
        
        maxJobDuration = self.config.maxJobDuration
        jobsToKill = []
        if maxJobDuration < 10000000:  # We won't bother doing anything if rescue time > 16 weeks.
            runningJobs = self.batchSystem.getRunningBatchJobIDs()
            for jobBatchSystemID in list(runningJobs.keys()):
                if runningJobs[jobBatchSystemID] > maxJobDuration:
                    logger.warn("The job: %s has been running for: %s seconds, more than the "
                                "max job duration: %s, we'll kill it",
                                str(self.jobBatchSystemIDToIssuedJob[jobBatchSystemID].jobStoreID),
                                str(runningJobs[jobBatchSystemID]),
                                str(maxJobDuration))
                    jobsToKill.append(jobBatchSystemID)
            self.killJobs(jobsToKill)
880325
public boolean isValid() {
		if (this.cpuCores >= 0 && this.heapMemoryInMB >= 0 && this.directMemoryInMB >= 0 &&
				this.nativeMemoryInMB >= 0 && this.stateSizeInMB >= 0) {
			for (Resource resource : extendedResources.values()) {
				if (resource.getValue() < 0) {
					return false;
				}
			}
			return true;
		} else {
			return false;
		}
	}