Fixed bug in `gam print|show crostelemetry

Updated multiprocessing to handle the following error that occurs on MacOS when a `gam csv` command
is interrupted with a contol-C.

It's a pyinstaller issue, revert to 5.13.2 for Mac OS
This commit is contained in:
Ross Scroggs
2023-11-18 08:49:28 -08:00
parent 06840c2608
commit f0cddbe7c2
6 changed files with 36 additions and 16 deletions

View File

@@ -2,7 +2,7 @@
Merged GAM-Team version
6.65.10
6.65.11
Updated multiprocessing to handle the following error that occurs on MacOS when a `gam csv` command
is interrupted with a contol-C.
@@ -10,6 +10,11 @@ is interrupted with a contol-C.
multiprocessing/resource_tracker.py:224: UserWarning: resource_tracker: There appear to be N leaked semaphore objects to clean up at shutdown
```
Fixed bug in `gam print|show crostelemetry` where no CrOS device data was displayed if no selection
options were chosen; now, data is displayed for all CrOS devices as documented.
6.65.10
Fixed bug in `gam print crostelemetry` that caused a trap: `KeyError: 'reportTime'`.
6.65.09

View File

@@ -9418,7 +9418,7 @@ def terminateStdQueueHandler(mpQueue, mpQueueHandler):
mpQueue.put((0, GM.REDIRECT_QUEUE_EOF, None))
mpQueueHandler.join()
def ProcessGAMCommandMulti(mplock, pid, numItems, logCmd, mpQueueCSVFile, mpQueueStdout, mpQueueStderr,
def ProcessGAMCommandMulti(pid, numItems, logCmd, mpQueueCSVFile, mpQueueStdout, mpQueueStderr,
debugLevel, todrive, printAguDomains,
printCrosOUs, printCrosOUsAndChildren,
output_dateformat, output_timeformat,
@@ -9429,6 +9429,8 @@ def ProcessGAMCommandMulti(mplock, pid, numItems, logCmd, mpQueueCSVFile, mpQueu
csvRowFilter, csvRowFilterMode, csvRowDropFilter, csvRowDropFilterMode,
csvRowLimit,
args):
global mplock
with mplock:
initializeLogging()
if sys.platform.startswith('win'):
@@ -9523,6 +9525,10 @@ def checkChildProcessRC(rc):
return not low <= rc <= high
return low <= rc <= high
def initGamWorker(l):
global mplock
mplock = l
def MultiprocessGAMCommands(items, showCmds):
def poolCallback(result):
poolProcessResults[0] -= 1
@@ -9545,12 +9551,12 @@ def MultiprocessGAMCommands(items, showCmds):
parallelPoolProcesses = min(numItems, GC.Values[GC.MULTIPROCESS_POOL_LIMIT])
origSigintHandler = signal.signal(signal.SIGINT, signal.SIG_IGN)
mpManager = multiprocessing.Manager()
mplock = mpManager.Lock()
l = mpManager.Lock()
try:
if multiprocessing.get_start_method() == 'spawn':
pool = mpManager.Pool(processes=numPoolProcesses, maxtasksperchild=200)
pool = mpManager.Pool(processes=numPoolProcesses, initializer=initGamWorker, initargs=(l,), maxtasksperchild=200)
else:
pool = multiprocessing.Pool(processes=numPoolProcesses, maxtasksperchild=200)
pool = multiprocessing.Pool(processes=numPoolProcesses, initializer=initGamWorker, initargs=(l,), maxtasksperchild=200)
except IOError as e:
systemErrorExit(FILE_ERROR_RC, e)
except AssertionError as e:
@@ -9623,7 +9629,7 @@ def MultiprocessGAMCommands(items, showCmds):
else:
logCmd = ''
poolProcessResults[pid] = pool.apply_async(ProcessGAMCommandMulti,
[mplock, pid, numItems, logCmd, mpQueueCSVFile, mpQueueStdout, mpQueueStderr,
[pid, numItems, logCmd, mpQueueCSVFile, mpQueueStdout, mpQueueStderr,
GC.Values[GC.DEBUG_LEVEL], GM.Globals[GM.CSV_TODRIVE],
GC.Values[GC.PRINT_AGU_DOMAINS],
GC.Values[GC.PRINT_CROS_OUS], GC.Values[GC.PRINT_CROS_OUS_AND_CHILDREN],
@@ -24133,6 +24139,8 @@ def doInfoPrintShowCrOSTelemetry():
readMask = ','.join(set(fieldsList))
if csvPF and FJQC.formatJSON:
csvPF.SetJSONTitles(['deviceId', 'JSON'])
if not pfilters:
pfilters = [(None, 'All')]
for pfilter in pfilters:
printGettingAllAccountEntities(Ent.CROS_DEVICE, pfilter[1])
pageMessage = getPageMessage()