Pass around srid for a single ID per run

This commit is contained in:
Nick Hurley 2013-01-16 12:40:58 -08:00
Родитель 3047917881
Коммит d88bac8a6d
3 изменённых файлов: 13 добавлений и 7 удалений

Просмотреть файл

@ -53,6 +53,7 @@ class StoneRidgeCloner(object):
self.path = '/'.join([root, path])
self.nightly = nightly
self.outroot = stoneridge.get_config('cloner', 'output')
self.srid = srid
self.outdir = os.path.join(self.outroot, srid)
self.keep = stoneridge.get_config_int('cloner', 'keep', default=50)
self.max_attempts = stoneridge.get_config_int('cloner', 'attempts')
@ -68,6 +69,7 @@ class StoneRidgeCloner(object):
logging.debug('host: %s' % (self.host,))
logging.debug('path: %s' % (self.path,))
logging.debug('nightly: %s' % (self.nightly,))
logging.debug('srid: %s' % (self.srid,))
logging.debug('output root: %s' % (self.outroot,))
logging.debug('output directory: %s' % (self.outdir,))
logging.debug('keep history: %s' % (self.keep,))
@ -253,6 +255,7 @@ class StoneRidgeCloner(object):
def defer(self):
args = ['srdeferrer.py',
'--srid', self.srid,
'--config', None, # TODO
'--log', '/dev/null',
'--pidfile', tempfile.mktemp(),

Просмотреть файл

@ -10,8 +10,9 @@ import stoneridge
class StoneRidgeDeferrer(object):
def __init__(self, nightly, ldap, sha, netconfigs, operating_systems,
def __init__(self, srid, nightly, ldap, sha, netconfigs, operating_systems,
attempt):
self.srid = srid
self.nightly = nightly
self.ldap = ldap
self.sha = sha
@ -30,8 +31,8 @@ class StoneRidgeDeferrer(object):
time.sleep(30)
now = int(time.time())
stoneridge.enqueue(nightly=self.nightly, ldap=self.ldap, sha=self.sha,
netconfigs=self.netconfigs,
stoneridge.enqueue(srid=self.srid, nightly=self.nightly, ldap=self.ldap,
sha=self.sha, netconfigs=self.netconfigs,
operating_systems=self.operating_systems,
attempt=self.attempt)
@ -46,7 +47,8 @@ def daemon(deferrer, args):
def main():
parser = stoneridge.DaemonArgumentParser()
parser.add_argument('--attempt', dest='attempt', type=int)
parser.add_argument('--srid', dest='srid', required=True)
parser.add_argument('--attempt', dest='attempt', type=int, required=True)
parser.add_argument('--nightly', dest='nightly', action='store_true',
default=False)
parser.add_argument('--ldap', dest='ldap', default='')
@ -60,7 +62,7 @@ def main():
args = parser.parse_args()
deferrer = StoneRidgeDeferrer(args.nightly, args.ldap, args.sha,
deferrer = StoneRidgeDeferrer(args.srid, args.nightly, args.ldap, args.sha,
args.netconfigs, args.operating_systems, args.attempt,
args.interval)

Просмотреть файл

@ -21,8 +21,9 @@ class StoneRidgeMaster(stoneridge.QueueListener):
self.config = config
def handle(self, nightly, ldap, sha, netconfigs, operating_systems,
attempt=1):
srid = str(uuid.uuid4())
srid=None, attempt=1):
if srid is None:
srid = str(uuid.uuid4())
logfile = 'cloner_%s.log' % (srid,)
cloner_log = os.path.join(self.logdir, logfile)
args = ['srcloner.py', '--config', self.config, '--srid', srid,