Пример #1
0
    def _kill(self, job_list):
        """ Handler to kill a list of jobs """

        if not ask("Kill %d job(s) ?" % len(job_list), parent=self.parent()):
            return

        user = os.getenv('USER', '<USER?>')
        reason = 'plow-wrangler - %s' % user

        for j in job_list:
            j.kill(reason)

        if self.__callback:
            self.__callback()
Пример #2
0
Файл: job.py Проект: Br3nda/plow
    def _kill(self, job_list):
        """ Handler to kill a list of jobs """

        if not ask("Kill %d job(s) ?" %  len(job_list), parent=self.parent()):
            return

        user = os.getenv('USER', '<USER?>')
        reason = 'plow-wrangler - %s' % user

        for j in job_list:
            j.kill(reason)

        if self.__callback:
            self.__callback()  
Пример #3
0
Файл: job.py Проект: Br3nda/plow
    def _action_on_tasks(self, fn, job_list, dead=False):
        """ Wrapper that applies a task action to a list of jobs """

        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=self.parent()):
            return

        if tasks:
            fn(tasks=tasks)

            if self.__callback:
                self.__callback()  
Пример #4
0
    def _action_on_tasks(self, fn, job_list, dead=False):
        """ Wrapper that applies a task action to a list of jobs """

        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=self.parent()):
            return

        if tasks:
            fn(tasks=tasks)

            if self.__callback:
                self.__callback()