Example #1
0
    def run_helper(job):
        """
        Helper function which takes a job and runs it task until it's finished

        :param job: Job to run
        :return:
        """
        assert job._sis_runnable()
        if not job._sis_finished():
            logging.info("Run Job: %s" % job)
            job._sis_setup_directory()
            for task in job._sis_tasks():
                for task_id in task.task_ids():
                    if not task.finished(task_id):
                        if len(job._sis_tasks()) > 1 or len(
                                task.task_ids()) > 1:
                            logging.info("Run Task: %s %s %s" %
                                         (job, task.name(), task_id))
                        log_file = task.path(gs.JOB_LOG, task_id)
                        env = os.environ.copy()
                        env.update(gs.ENVIRONMENT_SETTINGS)

                        call = " ".join(task.get_worker_call(task_id))
                        if quiet:
                            call += ' --redirect_output'
                        else:
                            call += ' 2>&1 %s' % log_file
                        subprocess.check_call(call, shell=True, env=env)
                        assert task.finished(
                            task_id), "Failed to run task %s %s %s" % (
                                job, task.name(), task_id)
Example #2
0
    def run_helper(job):
        """
        Helper function which takes a job and runs it task until it's finished

        :param job: Job to run
        :return:
        """
        assert job._sis_runnable()
        if not job._sis_finished():
            print()
            logging.info("Run Job: %s" % job)
            job._sis_setup_directory()
            for task in job._sis_tasks():
                for task_id in task.task_ids():
                    #print(job, task, task_id)
                    if not task.finished(task_id):
                        print()
                        logging.info("Run Task: %s %s %s" % (job, task.name(), task_id))
                        log_file = task.path(gs.JOB_LOG, task_id)
                        env = os.environ.copy()
                        env.update(gs.ENVIRONMENT_SETTINGS)
                        subprocess.check_call(" ".join(task.get_worker_call(task_id)) + ' 2>&1 | tee %s' % log_file,
                                              shell=True, env=env)