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:
Darko Poljak 2018-02-28 23:40:26 +01:00 committed by GitHub
commit 8eb0697b42
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 74 additions and 66 deletions

View file

@ -486,7 +486,6 @@ class Config(object):
objects_changed = False
for cdist_object in self.object_list():
try:
if cdist_object.requirements_unfinished(
cdist_object.requirements):
"""We cannot do anything for this poor object"""
@ -508,8 +507,6 @@ class Config(object):
if cdist_object.state == core.CdistObject.STATE_PREPARED:
self.object_run(cdist_object)
objects_changed = True
except cdist.Error as e:
raise cdist.CdistObjectError(cdist_object, e)
return objects_changed
@ -694,16 +691,20 @@ class Config(object):
def object_prepare(self, cdist_object, transfer_type_explorers=True):
"""Prepare object: Run type explorer + manifest"""
try:
self.log.verbose("Preparing object {}".format(cdist_object.name))
self.log.verbose(
"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)
cdist_object.state = core.CdistObject.STATE_PREPARED
except cdist.Error as e:
raise cdist.CdistObjectError(cdist_object, e)
def object_run(self, cdist_object):
"""Run gencode and code for an object"""
try:
self.log.verbose("Running object " + cdist_object.name)
if cdist_object.state == core.CdistObject.STATE_DONE:
raise cdist.Error(("Attempting to run an already finished "
@ -712,7 +713,8 @@ class Config(object):
# Generate
self.log.debug("Generating code for %s" % (cdist_object.name))
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:
cdist_object.changed = True
@ -733,3 +735,5 @@ class Config(object):
# Mark this object as done
self.log.trace("Finishing run of " + cdist_object.name)
cdist_object.state = core.CdistObject.STATE_DONE
except cdist.Error as e:
raise cdist.CdistObjectError(cdist_object, e)

View file

@ -24,6 +24,7 @@ import logging
import os
import glob
import multiprocessing
import cdist
from cdist.mputil import mp_pool_run
from . import util
@ -213,10 +214,11 @@ class Explorer(object):
def transfer_type_explorers(self, cdist_type):
"""Transfer the type explorers for the given type to the
remote side."""
try:
if cdist_type.explorers:
if cdist_type.name in self._type_explorers_transferred:
self.log.trace("Skipping retransfer of type explorers for: %s",
cdist_type)
self.log.trace(("Skipping retransfer of type explorers "
"for: %s"), cdist_type)
else:
source = os.path.join(self.local.type_path,
cdist_type.explorer_path)
@ -226,6 +228,8 @@ class Explorer(object):
self.remote.transfer(source, destination)
self.remote.run(["chmod", "0700", "%s/*" % (destination)])
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):
"""Transfer the parameters for the given object to the remote side."""