Two fixes

Updated multiprocessing to handle the following error that occurs on MacOS when a `gam csv` command
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 crostelemetry` that caused a trap: `KeyError: 'reportTime'`.
This commit is contained in:
Ross Scroggs
2023-11-17 11:12:29 -08:00
parent 87db64897d
commit 06840c2608
5 changed files with 38 additions and 24 deletions

View File

@@ -10,6 +10,16 @@ Add the `-s` option to the end of the above commands to suppress creating the `g
See [Downloads](https://github.com/taers232c/GAMADV-XTD3/wiki/Downloads) for Windows or other options, including manual installation
### 6.65.10
Updated multiprocessing to handle the following error that occurs on MacOS when a `gam csv` command
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 crostelemetry` that caused a trap: `KeyError: 'reportTime'`.
### 6.65.09
Added option `noduplicate` to `gam <UserTypeEntity> create drivefile` that causes GAM

View File

@@ -334,7 +334,7 @@ writes the credentials into the file oauth2.txt.
admin@server:/Users/admin/bin/gamadv-xtd3$ rm -f /Users/admin/GAMConfig/oauth2.txt
admin@server:/Users/admin/bin/gamadv-xtd3$ ./gam version
WARNING: Config File: /Users/admin/GAMConfig/gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: /Users/admin/GAMConfig/oauth2.txt, Not Found
GAMADV-XTD3 6.65.09 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.65.10 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.10.8 64-bit final
MacOS High Sierra 10.13.6 x86_64
@@ -1002,7 +1002,7 @@ writes the credentials into the file oauth2.txt.
C:\GAMADV-XTD3>del C:\GAMConfig\oauth2.txt
C:\GAMADV-XTD3>gam version
WARNING: Config File: C:\GAMConfig\gam.cfg, Section: DEFAULT, Item: oauth2_txt, Value: C:\GAMConfig\oauth2.txt, Not Found
GAMADV-XTD3 6.65.09 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.65.10 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.0 64-bit final
Windows-10-10.0.17134 AMD64

View File

@@ -4,7 +4,7 @@
Print the current version of Gam with details
```
gam version
GAMADV-XTD3 6.65.09 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.65.10 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.0 64-bit final
MacOS Monterey 12.7 x86_64
@@ -16,7 +16,7 @@ Time: 2023-06-02T21:10:00-07:00
Print the current version of Gam with details and time offset information
```
gam version timeoffset
GAMADV-XTD3 6.65.09 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.65.10 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.0 64-bit final
MacOS Monterey 12.7 x86_64
@@ -28,7 +28,7 @@ Your system time differs from www.googleapis.com by less than 1 second
Print the current version of Gam with extended details and SSL information
```
gam version extended
GAMADV-XTD3 6.65.09 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
GAMADV-XTD3 6.65.10 - https://github.com/taers232c/GAMADV-XTD3 - pythonsource
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.0 64-bit final
MacOS Monterey 12.7 x86_64
@@ -65,7 +65,7 @@ MacOS High Sierra 10.13.6 x86_64
Path: /Users/Admin/bin/gamadv-xtd3
Version Check:
Current: 5.35.08
Latest: 6.65.09
Latest: 6.65.10
echo $?
1
```
@@ -73,7 +73,7 @@ echo $?
Print the current version number without details
```
gam version simple
6.65.09
6.65.10
```
In Linux/MacOS you can do:
```
@@ -83,7 +83,7 @@ echo $VER
Print the current version of Gam and address of this Wiki
```
gam help
GAM 6.65.09 - https://github.com/taers232c/GAMADV-XTD3
GAM 6.65.10 - https://github.com/taers232c/GAMADV-XTD3
Ross Scroggs <ross.scroggs@gmail.com>
Python 3.12.0 64-bit final
MacOS Monterey 12.7 x86_64

View File

@@ -2,6 +2,16 @@
Merged GAM-Team version
6.65.10
Updated multiprocessing to handle the following error that occurs on MacOS when a `gam csv` command
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 crostelemetry` that caused a trap: `KeyError: 'reportTime'`.
6.65.09
Added option `noduplicate` to `gam <UserTypeEntity> create drivefile` that causes GAM

View File

@@ -370,9 +370,6 @@ YUBIKEY_VALUE_ERROR_RC = 85
YUBIKEY_MULTIPLE_CONNECTED_RC = 86
YUBIKEY_NOT_FOUND_RC = 87
# Multiprocessing lock
mplock = None
# stdin/stdout/stderr
def readStdin(prompt):
return input(prompt)
@@ -9421,7 +9418,7 @@ def terminateStdQueueHandler(mpQueue, mpQueueHandler):
mpQueue.put((0, GM.REDIRECT_QUEUE_EOF, None))
mpQueueHandler.join()
def ProcessGAMCommandMulti(pid, numItems, logCmd, mpQueueCSVFile, mpQueueStdout, mpQueueStderr,
def ProcessGAMCommandMulti(mplock, pid, numItems, logCmd, mpQueueCSVFile, mpQueueStdout, mpQueueStderr,
debugLevel, todrive, printAguDomains,
printCrosOUs, printCrosOUsAndChildren,
output_dateformat, output_timeformat,
@@ -9432,8 +9429,6 @@ def ProcessGAMCommandMulti(pid, numItems, logCmd, mpQueueCSVFile, mpQueueStdout,
csvRowFilter, csvRowFilterMode, csvRowDropFilter, csvRowDropFilterMode,
csvRowLimit,
args):
global mplock
with mplock:
initializeLogging()
if sys.platform.startswith('win'):
@@ -9528,10 +9523,6 @@ 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
@@ -9554,12 +9545,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()
l = mpManager.Lock()
mplock = mpManager.Lock()
try:
if multiprocessing.get_start_method() == 'spawn':
pool = mpManager.Pool(processes=numPoolProcesses, initializer=initGamWorker, initargs=(l,), maxtasksperchild=200)
pool = mpManager.Pool(processes=numPoolProcesses, maxtasksperchild=200)
else:
pool = multiprocessing.Pool(processes=numPoolProcesses, initializer=initGamWorker, initargs=(l,), maxtasksperchild=200)
pool = multiprocessing.Pool(processes=numPoolProcesses, maxtasksperchild=200)
except IOError as e:
systemErrorExit(FILE_ERROR_RC, e)
except AssertionError as e:
@@ -9632,7 +9623,7 @@ def MultiprocessGAMCommands(items, showCmds):
else:
logCmd = ''
poolProcessResults[pid] = pool.apply_async(ProcessGAMCommandMulti,
[pid, numItems, logCmd, mpQueueCSVFile, mpQueueStdout, mpQueueStderr,
[mplock, 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],
@@ -24012,8 +24003,11 @@ def doInfoPrintShowCrOSTelemetry():
device[field] = []
i = 0
for item in listItems:
timeValue, _ = iso8601.parse_date(item['reportTime'])
if ((startTime is None) or (timeValue >= startTime)) and ((endTime is None) or (timeValue <= endTime)):
if 'reportTime' in item:
timeValue, _ = iso8601.parse_date(item['reportTime'])
else:
timeValue = None
if (timeValue is None) or (((startTime is None) or (timeValue >= startTime)) and ((endTime is None) or (timeValue <= endTime))):
device[field].append(item)
i += 1
if listLimit and i == listLimit: