mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-18 22:26:30 +01:00
stop broken upgrade early-launch case
Wasn't checking for existance of script and so got and exception deleting what didn't exist. Instead I define nonexistance as being too early.
This commit is contained in:
parent
22f62d53e0
commit
91e6e50480
1 changed files with 7 additions and 3 deletions
|
@ -210,12 +210,16 @@ class Device():
|
||||||
|
|
||||||
def setApp(self, pct):
|
def setApp(self, pct):
|
||||||
if self.app == self.args.APP_OLD and not self.app == self.args.APP_NEW:
|
if self.app == self.args.APP_OLD and not self.app == self.args.APP_NEW:
|
||||||
if pct >= random.randint(0, 99):
|
if os.path.exists(self.script) and pct >= random.randint(0, 99):
|
||||||
print('launch(): upgrading from ', self.app, ' to ', self.args.APP_NEW)
|
print('launch(): upgrading {} from {} to {}' \
|
||||||
|
.format(self.devName(), self.app, self.args.APP_NEW))
|
||||||
self.app = self.args.APP_NEW
|
self.app = self.args.APP_NEW
|
||||||
# nuke script to force regeneration
|
# nuke script to force regeneration
|
||||||
os.unlink(self.script)
|
os.unlink(self.script)
|
||||||
|
|
||||||
|
def devName(self):
|
||||||
|
return 'dev_' + str(self.indx)
|
||||||
|
|
||||||
def logReaderMain(self):
|
def logReaderMain(self):
|
||||||
assert self and self.proc
|
assert self and self.proc
|
||||||
# print('logReaderMain called; opening:', self.logPath)
|
# print('logReaderMain called; opening:', self.logPath)
|
||||||
|
@ -679,7 +683,7 @@ def mkParser():
|
||||||
help = 'the app we\'ll upgrade from')
|
help = 'the app we\'ll upgrade from')
|
||||||
parser.add_argument('--start-pct', dest = 'START_PCT', default = 50, type = int,
|
parser.add_argument('--start-pct', dest = 'START_PCT', default = 50, type = int,
|
||||||
help = 'odds of starting with the new app, 0 <= n < 100')
|
help = 'odds of starting with the new app, 0 <= n < 100')
|
||||||
parser.add_argument('--upgrade-pct', dest = 'UPGRADE_PCT', default = 5, type = int,
|
parser.add_argument('--upgrade-pct', dest = 'UPGRADE_PCT', default = 20, type = int,
|
||||||
help = 'odds of upgrading at any launch, 0 <= n < 100')
|
help = 'odds of upgrading at any launch, 0 <= n < 100')
|
||||||
|
|
||||||
parser.add_argument('--num-games', dest = 'NGAMES', type = int, default = 1, help = 'number of games')
|
parser.add_argument('--num-games', dest = 'NGAMES', type = int, default = 1, help = 'number of games')
|
||||||
|
|
Loading…
Reference in a new issue