def build_job_jar(self, job):
    job_jar = job.jar()
    if job_jar:
        if (not os.path.exists(job_jar)):
            logger.error("Can't find jar: %s, full path %s", job_jar, os.path.abspath(job_jar))
            raise Exception('job jar does not exist')
        if (not job.job_class()):
            logger.error('Undefined job_class()')
            raise Exception('Undefined job_class()')
        return job_jar
    job_src = job.source()
    if (not job_src):
        logger.error('Both source() and jar() undefined')
        raise Exception('Both source() and jar() undefined')
    if (not os.path.exists(job_src)):
        logger.error("Can't find source: %s, full path %s", job_src, os.path.abspath(job_src))
        raise Exception('job source does not exist')
    job_src = job.source()
    job_jar = self.get_tmp_job_jar(job_src)
    build_dir = self.get_build_dir(job_src)
    if (not os.path.exists(build_dir)):
        os.makedirs(build_dir)
    classpath = ':'.join(filter(None, (((self.get_scalding_jars() + self.get_provided_jars()) + self.get_libjars()) + job.extra_jars())))
    scala_cp = ':'.join(self.get_scala_jars(include_compiler=True))
    arglist = ['java', '-cp', scala_cp, 'scala.tools.nsc.Main', '-classpath', classpath, '-d', build_dir, job_src]
    logger.info('Compiling scala source: %s', subprocess.list2cmdline(arglist))
    subprocess.check_call(arglist)
    arglist = ['jar', 'cf', job_jar, '-C', build_dir, '.']
    logger.info('Building job jar: %s', subprocess.list2cmdline(arglist))
    subprocess.check_call(arglist)
    return job_jar
def build_job_jar(self, job):
    job_jar = job.jar()
    if job_jar:
        if (not os.path.exists(job_jar)):
            logger.error("Can't find jar: %s, full path %s", job_jar, os.path.abspath(job_jar))
            raise Exception('job jar does not exist')
        if (not job.job_class()):
            logger.error('Undefined job_class()')
            raise Exception('Undefined job_class()')
        return job_jar
    job_src = job.source()
    if (not job_src):
        logger.error('Both source() and jar() undefined')
        raise Exception('Both source() and jar() undefined')
    if (not os.path.exists(job_src)):
        logger.error("Can't find source: %s, full path %s", job_src, os.path.abspath(job_src))
        raise Exception('job source does not exist')
    job_src = job.source()
    job_jar = self.get_tmp_job_jar(job_src)
    build_dir = self.get_build_dir(job_src)
    if (not os.path.exists(build_dir)):
        os.makedirs(build_dir)
    classpath = ':'.join(filter(None, (((self.get_scalding_jars() + self.get_provided_jars()) + self.get_libjars()) + job.extra_jars())))
    scala_cp = ':'.join(self.get_scala_jars(include_compiler=True))
    arglist = ['java', '-cp', scala_cp, 'scala.tools.nsc.Main', '-classpath', classpath, '-d', build_dir, job_src]
    logger.info('Compiling scala source: %s', subprocess.list2cmdline(arglist))
    subprocess.check_call(arglist)
    arglist = ['jar', 'cf', job_jar, '-C', build_dir, '.']
    logger.info('Building job jar: %s', subprocess.list2cmdline(arglist))
    subprocess.check_call(arglist)
    return job_jar