Revision f87b405e

b/lib/cli.py
687 687
  elif isinstance(err, errors.JobQueueDrainError):
688 688
    obuf.write("Failure: the job queue is marked for drain and doesn't"
689 689
               " accept new requests\n")
690
  elif isinstance(err, errors.JobQueueFull):
691
    obuf.write("Failure: the job queue is full and doesn't accept new"
692
               " job submissions until old jobs are archived\n")
690 693
  elif isinstance(err, errors.GenericError):
691 694
    obuf.write("Unhandled Ganeti error: %s" % msg)
692 695
  elif isinstance(err, luxi.NoMasterError):
b/lib/constants.py
366 366
JOB_QUEUE_SERIAL_FILE = QUEUE_DIR + "/serial"
367 367
JOB_QUEUE_ARCHIVE_DIR = QUEUE_DIR + "/archive"
368 368
JOB_QUEUE_DRAIN_FILE = QUEUE_DIR + "/drain"
369
JOB_QUEUE_SIZE_HARD_LIMIT = 5000
370
JOB_QUEUE_SIZE_SOFT_LIMIT = JOB_QUEUE_SIZE_HARD_LIMIT * 0.8
369 371

  
370 372
JOB_ID_TEMPLATE = r"\d+"
371 373

  
b/lib/errors.py
253 253
  """
254 254

  
255 255

  
256
class JobQueueFull(JobQueueError):
257
  """Job queue full error.
258

  
259
  Raised when job queue size reached its hard limit.
260

  
261
  """
262

  
263

  
256 264
# errors should be added above
257 265

  
258 266

  
b/lib/jqueue.py
941 941
    """
942 942
    if self._IsQueueMarkedDrain():
943 943
      raise errors.JobQueueDrainError()
944

  
945
    # Check job queue size
946
    size = len(self._ListJobFiles())
947
    if size >= constants.JOB_QUEUE_SIZE_SOFT_LIMIT:
948
      # TODO: Autoarchive jobs. Make sure it's not done on every job
949
      # submission, though.
950
      #size = ...
951
      pass
952

  
953
    if size >= constants.JOB_QUEUE_SIZE_HARD_LIMIT:
954
      raise errors.JobQueueFull()
955

  
944 956
    # Get job identifier
945 957
    job_id = self._NewSerialUnlocked()
946 958
    job = _QueuedJob(self, job_id, ops)

Also available in: Unified diff