def get_influence(self, task): value = getattr(task, tools.Tools(task).expand(self._attrib), "N/A") try: value = value.__get__(task) if type(value) == list and self._sort: value.sort() except AttributeError: pass return value
def _log(follow, delete): """ Display the Jolt log file. """ if follow: subprocess.call("tail -f {0}".format(logfile), shell=True) elif delete: fs.unlink(logfile) else: t = tools.Tools() configured_pager = config.get("jolt", "pager", environ.get("PAGER", None)) for pager in [configured_pager, "less", "more", "cat"]: if pager and t.which(pager): return subprocess.call("{1} {0}".format(logfile, pager), shell=True) print(t.read_file(logfile))
def clean(ctx, task, deps, expired): """ Delete task artifacts and intermediate files. When run without arguments, this command removes all task artifacts from the local cache, but no intermediate files are removed. When TASK is specified, the task clean() method is invoked to remove any intermediate files still present in persistent build directories. Secondly, the task artifact will be removed from the local cache. Global caches are not affected. The --deps parameter can be used to also clean all dependencies of the specified TASK. By default, task artifacts are removed without considering any artifact expiration metadata. To only remove artifact which have expired, use the --expired parameter. Artifacts typically expire immediately after creation unless explicitly configured not to. """ acache = cache.ArtifactCache.get() if task: task = [utils.stable_task_name(t) for t in task] registry = TaskRegistry.get() dag = graph.GraphBuilder(registry, ctx.obj["manifest"]).build(task) if deps: tasks = dag.tasks else: tasks = dag.goals for task in tasks: task.clean(acache, expired) else: acache.discard_all(expired, onerror=fs.onerror_warning) try: # May not be in a workspace when running the command t = tools.Tools() fs.rmtree(t.buildroot, onerror=fs.onerror_warning) except AssertionError: pass
def __init__(self, options=None): max_workers = tools.Tools().thread_count() super(ConcurrentLocalExecutorFactory, self).__init__(options=options, max_workers=max_workers)
def _image(self): registry = TaskRegistry.get() tool = tools.Tools(self) if registry.get_task_class(tool.expand(self.image)): return [self.image] return []