Package ganeti :: Module jqueue
[hide private]
[frames] | no frames]

Module jqueue

source code

Module implementing the job queue handling.

Locking: there's a single, large lock in the JobQueue class. It's used by all other classes in this module.

Classes [hide private]
  CancelJob
Special exception to cancel a job.
  _QueuedOpCode
Encapsulates an opcode object.
  _QueuedJob
In-memory job representation.
  _OpExecCallbacks
  _JobChangesChecker
  _JobFileChangesWaiter
  _JobChangesWaiter
  _WaitForJobChangesHelper
Helper class using inotify to wait for changes in a job file.
  _JobQueueWorker
The actual job workers.
  _JobQueueWorkerPool
Simple class implementing a job-processing workerpool.
  JobQueue
Queue used to manage the jobs.
Functions [hide private]
tuple
TimeStampNow()
Returns the current timestamp.
source code
 
_EncodeOpError(err)
Encodes an error which occurred while processing an opcode.
source code
 
_RequireOpenQueue(fn)
Decorator for "public" functions.
source code
Variables [hide private]
  JOBQUEUE_THREADS = 25
the number of worker threads we start for processing jobs
  JOBS_PER_ARCHIVE_DIRECTORY = 10000
  _LOCK = "_lock"
  _QUEUE = "_queue"

Imports: os, logging, errno, re, time, weakref, pyinotify, asyncnotifier, constants, serializer, workerpool, locking, opcodes, errors, mcpu, utils, jstore, rpc, netutils, compat


Function Details [hide private]

TimeStampNow()

source code 

Returns the current timestamp.

Returns: tuple
the current time in the (seconds, microseconds) format

_RequireOpenQueue(fn)

source code 

Decorator for "public" functions.

This function should be used for all 'public' functions. That is, functions usually called from other classes. Note that this should be applied only to methods (not plain functions), since it expects that the decorated function is called with a first argument that has a '_queue_filelock' argument.

Warning: Use this decorator only after locking.ssynchronized

Example:

 @locking.ssynchronized(_LOCK)
 @_RequireOpenQueue
 def Example(self):
   pass