no clear() in python < 3.3; if only one then do it sequentially
This commit is contained in:
parent
e79519afce
commit
ca3a8ddf67
1 changed files with 9 additions and 3 deletions
|
@ -320,13 +320,16 @@ class Config(object):
|
||||||
# objects_changed = True
|
# objects_changed = True
|
||||||
cargo.append(cdist_object)
|
cargo.append(cdist_object)
|
||||||
|
|
||||||
if cargo:
|
if len(cargo) == 1:
|
||||||
|
self.object_prepare(cargo[0])
|
||||||
|
objects_changed = True
|
||||||
|
elif cargo:
|
||||||
with concurrent.futures.ProcessPoolExecutor(self.jobs) as executor:
|
with concurrent.futures.ProcessPoolExecutor(self.jobs) as executor:
|
||||||
for x in executor.map(self.object_prepare, cargo):
|
for x in executor.map(self.object_prepare, cargo):
|
||||||
pass # returns None
|
pass # returns None
|
||||||
objects_changed = True
|
objects_changed = True
|
||||||
|
|
||||||
cargo.clear()
|
del cargo[:]
|
||||||
for cdist_object in self.object_list():
|
for cdist_object in self.object_list():
|
||||||
if cdist_object.requirements_unfinished(cdist_object.requirements):
|
if cdist_object.requirements_unfinished(cdist_object.requirements):
|
||||||
"""We cannot do anything for this poor object"""
|
"""We cannot do anything for this poor object"""
|
||||||
|
@ -344,7 +347,10 @@ class Config(object):
|
||||||
# objects_changed = True
|
# objects_changed = True
|
||||||
cargo.append(cdist_object)
|
cargo.append(cdist_object)
|
||||||
|
|
||||||
if cargo:
|
if len(cargo) == 1:
|
||||||
|
self.object_run(cargo[0])
|
||||||
|
objects_changed = True
|
||||||
|
elif cargo:
|
||||||
with concurrent.futures.ProcessPoolExecutor(self.jobs) as executor:
|
with concurrent.futures.ProcessPoolExecutor(self.jobs) as executor:
|
||||||
for x in executor.map(self.object_run, cargo):
|
for x in executor.map(self.object_run, cargo):
|
||||||
pass # returns None
|
pass # returns None
|
||||||
|
|
Loading…
Reference in a new issue