зеркало из https://github.com/mozilla/stoneridge.git
Pass around srid for a single ID per run
This commit is contained in:
Родитель
3047917881
Коммит
d88bac8a6d
|
@ -53,6 +53,7 @@ class StoneRidgeCloner(object):
|
||||||
self.path = '/'.join([root, path])
|
self.path = '/'.join([root, path])
|
||||||
self.nightly = nightly
|
self.nightly = nightly
|
||||||
self.outroot = stoneridge.get_config('cloner', 'output')
|
self.outroot = stoneridge.get_config('cloner', 'output')
|
||||||
|
self.srid = srid
|
||||||
self.outdir = os.path.join(self.outroot, srid)
|
self.outdir = os.path.join(self.outroot, srid)
|
||||||
self.keep = stoneridge.get_config_int('cloner', 'keep', default=50)
|
self.keep = stoneridge.get_config_int('cloner', 'keep', default=50)
|
||||||
self.max_attempts = stoneridge.get_config_int('cloner', 'attempts')
|
self.max_attempts = stoneridge.get_config_int('cloner', 'attempts')
|
||||||
|
@ -68,6 +69,7 @@ class StoneRidgeCloner(object):
|
||||||
logging.debug('host: %s' % (self.host,))
|
logging.debug('host: %s' % (self.host,))
|
||||||
logging.debug('path: %s' % (self.path,))
|
logging.debug('path: %s' % (self.path,))
|
||||||
logging.debug('nightly: %s' % (self.nightly,))
|
logging.debug('nightly: %s' % (self.nightly,))
|
||||||
|
logging.debug('srid: %s' % (self.srid,))
|
||||||
logging.debug('output root: %s' % (self.outroot,))
|
logging.debug('output root: %s' % (self.outroot,))
|
||||||
logging.debug('output directory: %s' % (self.outdir,))
|
logging.debug('output directory: %s' % (self.outdir,))
|
||||||
logging.debug('keep history: %s' % (self.keep,))
|
logging.debug('keep history: %s' % (self.keep,))
|
||||||
|
@ -253,6 +255,7 @@ class StoneRidgeCloner(object):
|
||||||
|
|
||||||
def defer(self):
|
def defer(self):
|
||||||
args = ['srdeferrer.py',
|
args = ['srdeferrer.py',
|
||||||
|
'--srid', self.srid,
|
||||||
'--config', None, # TODO
|
'--config', None, # TODO
|
||||||
'--log', '/dev/null',
|
'--log', '/dev/null',
|
||||||
'--pidfile', tempfile.mktemp(),
|
'--pidfile', tempfile.mktemp(),
|
||||||
|
|
|
@ -10,8 +10,9 @@ import stoneridge
|
||||||
|
|
||||||
|
|
||||||
class StoneRidgeDeferrer(object):
|
class StoneRidgeDeferrer(object):
|
||||||
def __init__(self, nightly, ldap, sha, netconfigs, operating_systems,
|
def __init__(self, srid, nightly, ldap, sha, netconfigs, operating_systems,
|
||||||
attempt):
|
attempt):
|
||||||
|
self.srid = srid
|
||||||
self.nightly = nightly
|
self.nightly = nightly
|
||||||
self.ldap = ldap
|
self.ldap = ldap
|
||||||
self.sha = sha
|
self.sha = sha
|
||||||
|
@ -30,8 +31,8 @@ class StoneRidgeDeferrer(object):
|
||||||
time.sleep(30)
|
time.sleep(30)
|
||||||
now = int(time.time())
|
now = int(time.time())
|
||||||
|
|
||||||
stoneridge.enqueue(nightly=self.nightly, ldap=self.ldap, sha=self.sha,
|
stoneridge.enqueue(srid=self.srid, nightly=self.nightly, ldap=self.ldap,
|
||||||
netconfigs=self.netconfigs,
|
sha=self.sha, netconfigs=self.netconfigs,
|
||||||
operating_systems=self.operating_systems,
|
operating_systems=self.operating_systems,
|
||||||
attempt=self.attempt)
|
attempt=self.attempt)
|
||||||
|
|
||||||
|
@ -46,7 +47,8 @@ def daemon(deferrer, args):
|
||||||
def main():
|
def main():
|
||||||
parser = stoneridge.DaemonArgumentParser()
|
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',
|
parser.add_argument('--nightly', dest='nightly', action='store_true',
|
||||||
default=False)
|
default=False)
|
||||||
parser.add_argument('--ldap', dest='ldap', default='')
|
parser.add_argument('--ldap', dest='ldap', default='')
|
||||||
|
@ -60,7 +62,7 @@ def main():
|
||||||
|
|
||||||
args = parser.parse_args()
|
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.netconfigs, args.operating_systems, args.attempt,
|
||||||
args.interval)
|
args.interval)
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,9 @@ class StoneRidgeMaster(stoneridge.QueueListener):
|
||||||
self.config = config
|
self.config = config
|
||||||
|
|
||||||
def handle(self, nightly, ldap, sha, netconfigs, operating_systems,
|
def handle(self, nightly, ldap, sha, netconfigs, operating_systems,
|
||||||
attempt=1):
|
srid=None, attempt=1):
|
||||||
srid = str(uuid.uuid4())
|
if srid is None:
|
||||||
|
srid = str(uuid.uuid4())
|
||||||
logfile = 'cloner_%s.log' % (srid,)
|
logfile = 'cloner_%s.log' % (srid,)
|
||||||
cloner_log = os.path.join(self.logdir, logfile)
|
cloner_log = os.path.join(self.logdir, logfile)
|
||||||
args = ['srcloner.py', '--config', self.config, '--srid', srid,
|
args = ['srcloner.py', '--config', self.config, '--srid', srid,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче