forked from ungleich-public/cdist
Merge pull request #640 from darko-poljak/bugfix/error_info_lost_with_jobs_#632
[BETA] bug: error info lost with parallel (option -j) #632
This commit is contained in:
commit
8eb0697b42
2 changed files with 74 additions and 66 deletions
|
@ -486,7 +486,6 @@ class Config(object):
|
||||||
objects_changed = False
|
objects_changed = False
|
||||||
|
|
||||||
for cdist_object in self.object_list():
|
for cdist_object in self.object_list():
|
||||||
try:
|
|
||||||
if cdist_object.requirements_unfinished(
|
if cdist_object.requirements_unfinished(
|
||||||
cdist_object.requirements):
|
cdist_object.requirements):
|
||||||
"""We cannot do anything for this poor object"""
|
"""We cannot do anything for this poor object"""
|
||||||
|
@ -508,8 +507,6 @@ class Config(object):
|
||||||
if cdist_object.state == core.CdistObject.STATE_PREPARED:
|
if cdist_object.state == core.CdistObject.STATE_PREPARED:
|
||||||
self.object_run(cdist_object)
|
self.object_run(cdist_object)
|
||||||
objects_changed = True
|
objects_changed = True
|
||||||
except cdist.Error as e:
|
|
||||||
raise cdist.CdistObjectError(cdist_object, e)
|
|
||||||
|
|
||||||
return objects_changed
|
return objects_changed
|
||||||
|
|
||||||
|
@ -694,16 +691,20 @@ class Config(object):
|
||||||
|
|
||||||
def object_prepare(self, cdist_object, transfer_type_explorers=True):
|
def object_prepare(self, cdist_object, transfer_type_explorers=True):
|
||||||
"""Prepare object: Run type explorer + manifest"""
|
"""Prepare object: Run type explorer + manifest"""
|
||||||
|
try:
|
||||||
self.log.verbose("Preparing object {}".format(cdist_object.name))
|
self.log.verbose("Preparing object {}".format(cdist_object.name))
|
||||||
self.log.verbose(
|
self.log.verbose(
|
||||||
"Running manifest and explorers for " + cdist_object.name)
|
"Running manifest and explorers for " + cdist_object.name)
|
||||||
self.explorer.run_type_explorers(cdist_object, transfer_type_explorers)
|
self.explorer.run_type_explorers(cdist_object,
|
||||||
|
transfer_type_explorers)
|
||||||
self.manifest.run_type_manifest(cdist_object)
|
self.manifest.run_type_manifest(cdist_object)
|
||||||
cdist_object.state = core.CdistObject.STATE_PREPARED
|
cdist_object.state = core.CdistObject.STATE_PREPARED
|
||||||
|
except cdist.Error as e:
|
||||||
|
raise cdist.CdistObjectError(cdist_object, e)
|
||||||
|
|
||||||
def object_run(self, cdist_object):
|
def object_run(self, cdist_object):
|
||||||
"""Run gencode and code for an object"""
|
"""Run gencode and code for an object"""
|
||||||
|
try:
|
||||||
self.log.verbose("Running object " + cdist_object.name)
|
self.log.verbose("Running object " + cdist_object.name)
|
||||||
if cdist_object.state == core.CdistObject.STATE_DONE:
|
if cdist_object.state == core.CdistObject.STATE_DONE:
|
||||||
raise cdist.Error(("Attempting to run an already finished "
|
raise cdist.Error(("Attempting to run an already finished "
|
||||||
|
@ -712,7 +713,8 @@ class Config(object):
|
||||||
# Generate
|
# Generate
|
||||||
self.log.debug("Generating code for %s" % (cdist_object.name))
|
self.log.debug("Generating code for %s" % (cdist_object.name))
|
||||||
cdist_object.code_local = self.code.run_gencode_local(cdist_object)
|
cdist_object.code_local = self.code.run_gencode_local(cdist_object)
|
||||||
cdist_object.code_remote = self.code.run_gencode_remote(cdist_object)
|
cdist_object.code_remote = self.code.run_gencode_remote(
|
||||||
|
cdist_object)
|
||||||
if cdist_object.code_local or cdist_object.code_remote:
|
if cdist_object.code_local or cdist_object.code_remote:
|
||||||
cdist_object.changed = True
|
cdist_object.changed = True
|
||||||
|
|
||||||
|
@ -733,3 +735,5 @@ class Config(object):
|
||||||
# Mark this object as done
|
# Mark this object as done
|
||||||
self.log.trace("Finishing run of " + cdist_object.name)
|
self.log.trace("Finishing run of " + cdist_object.name)
|
||||||
cdist_object.state = core.CdistObject.STATE_DONE
|
cdist_object.state = core.CdistObject.STATE_DONE
|
||||||
|
except cdist.Error as e:
|
||||||
|
raise cdist.CdistObjectError(cdist_object, e)
|
||||||
|
|
|
@ -24,6 +24,7 @@ import logging
|
||||||
import os
|
import os
|
||||||
import glob
|
import glob
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
|
import cdist
|
||||||
from cdist.mputil import mp_pool_run
|
from cdist.mputil import mp_pool_run
|
||||||
from . import util
|
from . import util
|
||||||
|
|
||||||
|
@ -213,10 +214,11 @@ class Explorer(object):
|
||||||
def transfer_type_explorers(self, cdist_type):
|
def transfer_type_explorers(self, cdist_type):
|
||||||
"""Transfer the type explorers for the given type to the
|
"""Transfer the type explorers for the given type to the
|
||||||
remote side."""
|
remote side."""
|
||||||
|
try:
|
||||||
if cdist_type.explorers:
|
if cdist_type.explorers:
|
||||||
if cdist_type.name in self._type_explorers_transferred:
|
if cdist_type.name in self._type_explorers_transferred:
|
||||||
self.log.trace("Skipping retransfer of type explorers for: %s",
|
self.log.trace(("Skipping retransfer of type explorers "
|
||||||
cdist_type)
|
"for: %s"), cdist_type)
|
||||||
else:
|
else:
|
||||||
source = os.path.join(self.local.type_path,
|
source = os.path.join(self.local.type_path,
|
||||||
cdist_type.explorer_path)
|
cdist_type.explorer_path)
|
||||||
|
@ -226,6 +228,8 @@ class Explorer(object):
|
||||||
self.remote.transfer(source, destination)
|
self.remote.transfer(source, destination)
|
||||||
self.remote.run(["chmod", "0700", "%s/*" % (destination)])
|
self.remote.run(["chmod", "0700", "%s/*" % (destination)])
|
||||||
self._type_explorers_transferred.append(cdist_type.name)
|
self._type_explorers_transferred.append(cdist_type.name)
|
||||||
|
except cdist.Error as e:
|
||||||
|
raise cdist.CdistObjectError(cdist_object, e)
|
||||||
|
|
||||||
def transfer_object_parameters(self, cdist_object):
|
def transfer_object_parameters(self, cdist_object):
|
||||||
"""Transfer the parameters for the given object to the remote side."""
|
"""Transfer the parameters for the given object to the remote side."""
|
||||||
|
|
Loading…
Reference in a new issue