* Set maxtasksperchild to help avoid hangs especially on Windows

* Fix function reference
This commit is contained in:
Ross Scroggs
2020-08-11 09:47:03 -07:00
committed by GitHub
parent dbc47c5420
commit 3368bd3879
2 changed files with 5 additions and 4 deletions

View File

@@ -10959,7 +10959,7 @@ def run_batch(items):
if not items:
return
num_worker_threads = min(len(items), GC_Values[GC_NUM_THREADS])
pool = mp_pool(num_worker_threads, init_gam_worker)
pool = mp_pool(num_worker_threads, init_gam_worker, maxtasksperchild=200)
sys.stderr.write(f'Using {num_worker_threads} processes...\n')
try:
results = []

View File

@@ -7,6 +7,7 @@ from gam import display
from gam import fileutils
from gam import gapi
from gam.gapi import directory as gapi_directory
from gam.gapi.directory import orgunits as gapi_directory_orgunits
from gam import utils
@@ -32,7 +33,7 @@ def doUpdateCros():
update_body['annotatedAssetId'] = sys.argv[i + 1]
i += 2
elif myarg in ['ou', 'org']:
orgUnitPath = gam.getOrgUnitItem(sys.argv[i + 1])
orgUnitPath = gapi_directory_orgunits.getOrgUnitItem(sys.argv[i + 1])
i += 2
elif myarg == 'action':
action = sys.argv[i + 1].lower().replace('_', '').replace('-', '')
@@ -358,7 +359,7 @@ def doPrintCrosActivity():
queries = gam.getQueries(myarg, sys.argv[i + 1])
i += 2
elif myarg == 'limittoou':
orgUnitPath = gam.getOrgUnitItem(sys.argv[i + 1])
orgUnitPath = gapi_directory_orgunits.getOrgUnitItem(sys.argv[i + 1])
i += 2
elif myarg == 'todrive':
todrive = True
@@ -526,7 +527,7 @@ def doPrintCrosDevices():
queries = gam.getQueries(myarg, sys.argv[i + 1])
i += 2
elif myarg == 'limittoou':
orgUnitPath = gam.getOrgUnitItem(sys.argv[i + 1])
orgUnitPath = gapi_directory_orgunits.getOrgUnitItem(sys.argv[i + 1])
i += 2
elif myarg == 'todrive':
todrive = True