コード例 #1
0
ファイル: parallelbuild.py プロジェクト: nudded/easybuild
def create_job(build_command, package, output_dir=""):
    """
    Creates a job, to build a *single* package
    build_command is a format string in which a full path to an eb file will be substituted
    package should be in the format as processEasyConfig returns them
    output_dir is an optional path. EASYBUILDTESTOUTPUT will be set inside the job with this variable
    returns the job
    """
    # create command based on build_command template
    command = build_command % package['spec']

    # capture PYTHONPATH, MODULEPATH and all variables starting with EASYBUILD
    easybuild_vars = {}
    for name in os.environ:
        if name.startswith("EASYBUILD"):
            easybuild_vars[name] = os.environ[name]

    others = ["PYTHONPATH", "MODULEPATH"]

    for env_var in others:
        if env_var in os.environ:
            easybuild_vars[env_var] = os.environ[env_var]

    # create unique name based on module name
    name = "%s-%s" % package['module']

    easybuild_vars['EASYBUILDTESTOUTPUT'] = os.path.join(os.path.abspath(output_dir), name)

    # just use latest build stats
    buildstats = getRepository().get_buildstats(*package['module'])
    resources = {}
    if buildstats:
        previous_time = buildstats[-1]['build_time']
        resources['hours'] = int(math.ceil(previous_time * 2 / 60))

    job = PbsJob(command, name, easybuild_vars, resources=resources)
    job.module = package['module']

    return job
コード例 #2
0
ファイル: build.py プロジェクト: nudded/easybuild
        log.info("Submitted parallel build jobs, exiting now")
        sys.exit(0)

    ## Build software, will exit when errors occurs (except when regtesting)
    correct_built_cnt = 0
    all_built_cnt = 0
    for spec in orderedSpecs:
        (success, _) = build(spec, options, log, origEnviron, exitOnFailure=(not options.regtest))
        if success:
            correct_built_cnt += 1
        all_built_cnt += 1

    print_msg("Build succeeded for %s out of %s" % (correct_built_cnt, all_built_cnt), log)

    getRepository().cleanup()
    ## Cleanup tmp log file (all is well, all modules have their own log file)
    try:
        removeLogHandler(hn)
        hn.close()
        if logFile:
            os.remove(logFile)

        for package in packages:
            if "originalSpec" in package:
                os.remove(package["spec"])

    except IOError, err:
        error("Something went wrong closing and removing the log %s : %s" % (logFile, err))