예제 #1
0
def _clean():

  logger.info("Removing pid file")
  try:
    os.unlink(pidfile)
  except Exception as ex:
    traceback.print_exc()
    logger.warn("Unable to remove pid file: %s", ex)

  logger.info("Removing temp files")
  for f in getTempFiles():
    if os.path.exists(f):
      try:
        os.unlink(f)
      except Exception as ex:
        traceback.print_exc()
        logger.warn("Unable to remove: %s, %s", f, ex)
예제 #2
0
def _clean():

  logger.info("Removing pid file")
  try:
    os.unlink(pidfile)
  except Exception as ex:
    traceback.print_exc()
    logger.warn("Unable to remove pid file: %s", ex)

  logger.info("Removing temp files")
  for f in getTempFiles():
    if os.path.exists(f):
      try:
        os.unlink(f)
      except Exception as ex:
        traceback.print_exc()
        logger.warn("Unable to remove: %s, %s", f, ex)
예제 #3
0
파일: main.py 프로젝트: sreev/ambari
def signal_handler(signum, frame):
  #we want the handler to run only for the agent process and not
  #for the children (e.g. namenode, etc.)
  if (os.getpid() != agentPid):
    os._exit(0)
  logger.info('signal received, exiting.')
  try:
    os.unlink(pidfile)
  except Exception:
    logger.warn("Unable to remove: "+pidfile)
    traceback.print_exc()

  tempFiles = getTempFiles()
  for tempFile in tempFiles:
    if os.path.exists(tempFile):
      try:
        os.unlink(tempFile)
      except Exception:
        traceback.print_exc()
        logger.warn("Unable to remove: "+tempFile)
  os._exit(0)