def kill_fn(job_list): if not ask("Kill %d job(s) ?" % len(job_list), parent=parent): return for j in job_list: j.kill('plow-wrangler') if refreshCallback: refreshCallback()
def action_on_tasks(fn, job_list, dead=False): if dead: states = [plow.client.TaskState.DEAD] else: states = [] tasks = list(chain.from_iterable(j.get_tasks(states=states) for j in job_list)) if not tasks: return msg = "Run %r on %d jobs (%d tasks) ?" % (fn.__name__, len(job_list), len(tasks)) if not ask(msg, parent=parent): return if tasks: fn(tasks=tasks) if refreshCallback: refreshCallback()
def action_on_tasks(fn, job_list, dead=False): if dead: states = [plow.client.TaskState.DEAD] else: states = [] tasks = list( chain.from_iterable(j.get_tasks(states=states) for j in job_list)) if not tasks: return msg = "Run %r on %d jobs (%d tasks) ?" % (fn.__name__, len(job_list), len(tasks)) if not ask(msg, parent=parent): return if tasks: fn(tasks=tasks) if refreshCallback: refreshCallback()