Fix parallel object prepare and run steps. Add nonparallel type marker.

This commit is contained in:
Darko Poljak 2017-07-14 21:47:30 +02:00
commit 126a1812a5
25 changed files with 97 additions and 28 deletions

View file

@ -66,6 +66,9 @@ class CdistType(object):
self.__boolean_parameters = None
self.__parameter_defaults = None
def __hash__(self):
return hash(self.name)
@classmethod
def list_types(cls, base_path):
"""Return a list of type instances"""
@ -112,6 +115,12 @@ class CdistType(object):
(if not: for configuration)"""
return os.path.isfile(os.path.join(self.absolute_path, "install"))
@property
def is_nonparallel(self):
"""Check whether a type is a non parallel, i.e. its objects
cannot run in parallel."""
return os.path.isfile(os.path.join(self.absolute_path, "nonparallel"))
@property
def explorers(self):
"""Return a list of available explorers"""

View file

@ -141,7 +141,9 @@ class Code(object):
destination = os.path.join(self.remote.object_path,
cdist_object.code_remote_path)
# FIXME: BUG: do not create destination, but top level of destination!
self.remote.mkdir(destination)
# self.remote.mkdir(destination)
# FIX?
self.remote.mkdir(os.path.dirname(destination))
self.remote.transfer(source, destination)
def _run_code(self, cdist_object, which, env=None):

View file

@ -163,16 +163,21 @@ class Explorer(object):
except EnvironmentError:
return []
def run_type_explorers(self, cdist_object):
def run_type_explorers(self, cdist_object, transfer_type_explorers=True):
"""Run the type explorers for the given object and save their output
in the object.
"""
self.log.verbose("Running type explorers for {}".format(
cdist_object.cdist_type))
self.log.trace("Transfering type explorers for type: %s",
cdist_object.cdist_type)
self.transfer_type_explorers(cdist_object.cdist_type)
if transfer_type_explorers:
self.log.trace("Transfering type explorers for type: %s",
cdist_object.cdist_type)
self.transfer_type_explorers(cdist_object.cdist_type)
else:
self.log.trace(("No need for transfering type explorers for "
"type: %s"),
cdist_object.cdist_type)
self.log.trace("Transfering object parameters for object: %s",
cdist_object.name)
self.transfer_object_parameters(cdist_object)