def replace_targets(self, target_roots): """Replaces all targets in the context with the given roots and their transitive dependencies. """ self._target_roots = list(target_roots) self._targets = OrderedSet() for target in self._target_roots: self.add_target(target) self.id = Target.identify(self._targets)
def add(self, targets, cache_key, valid, phase=None): if not phase: raise ValueError('Must specify a descriptive phase= value (e.g. "init", "pre-check", ...') # Manufacture an id from a hash of the target ids targets_hash = Target.identify(targets) self._entries.append(self.TaskEntry(targets_hash=targets_hash, target_ids=[t.id for t in targets], cache_key_id=cache_key.id, cache_key_hash=cache_key.hash, valid=valid, phase=phase))
def add(self, targets, cache_key, valid, phase=None): if not phase: raise ValueError('Must specify a descriptive phase= value (e.g. "init", "pre-check", ...') # Manufacture an id from a hash of the target ids targets_hash = Target.identify(targets) self._entries.append( self.TaskEntry( targets_hash=targets_hash, target_ids=[t.id for t in targets], cache_key_id=cache_key.id, cache_key_hash=cache_key.hash, valid=valid, phase=phase, ) )
def __str__(self): ident = Target.identify(self.targets()) return 'Context(id:%s, targets:%s)' % (ident, self.targets())
def __str__(self): ident = Target.identify(self.targets()) return 'Context(id:{}, targets:{})'.format(ident, self.targets())