def test_processRunnin1(self): """processRunning""" self.assertTrue(Utils.processRunning(os.getpid())) self.assertFalse(Utils.processRunning(44565))
DBlogging.change_logfile(logname) if options.loglevel not in DBlogging.LEVELS: parser.error("invalid --log-level specified") DBlogging.dblogger.setLevel(DBlogging.LEVELS[options.loglevel]) pq = dbprocessing.ProcessQueue(options.mission, dryrun=options.dryrun, echo=options.echo) # check currently processing curr_proc = pq.dbu.currentlyProcessing() if curr_proc: # returns False or the PID # check if the PID is running if Utils.processRunning(curr_proc): # we still have an instance processing, don't start another pq.dbu.closeDB() DBlogging.dblogger.error( "There is a process running, can't start another: PID: %d" % (curr_proc)) raise (ProcessException( "There is a process running, can't start another: PID: %d" % (curr_proc))) else: # There is a processing flag set but it died, don't start another pq.dbu.closeDB() DBlogging.dblogger.error( "There is a processing flag set but it died, don't start another" ) raise (ProcessException(