#!/usr/bin/python
import ConfigParser
+import fcntl
import os.path
import random
import sys
return gen.run()
def call_batch(self, args):
+ try:
+ self._lock = open(LOCK_BATCH, "a+")
+ except IOError, e:
+ return 0
+
+ try:
+ fcntl.lockf(self._lock.fileno(), fcntl.LOCK_EX | fcntl.LOCK_NB)
+ except IOError, e:
+ print >>sys.stderr, "Batch operations are locked by another process"
+ return 0
+
actionmap = {
"cron" : self.call_batch_cron,
}
CHROOT_PATH = "/sbin:/bin:/usr/sbin:/usr/bin"
+LOCK_BATCH = os.path.join(BUILDDIR, ".batch")
+
LOG_MARKER = "### LOG MARKER ###"
def calc_parallelism():