def arch(parser, args): if args.platform: print architecture.platform() else: print architecture.sys_type()
def arch(parser, args): configured_sys_type = architecture.get_sys_type_from_spack_globals() if not configured_sys_type: configured_sys_type = "autodetect" print "Configured sys_type: %s" % configured_sys_type print "Autodetected default sys_type: %s" % architecture.sys_type()
def arch(parser, args): configured_sys_type = architecture.get_sys_type_from_spack_globals() if not configured_sys_type: configured_sys_type = "autodetect" print "Configured sys_type: %s" % configured_sys_type print "Autodetected default sys_type: %s" % architecture.sys_type()
def release_jobs(parser, args): share_path = os.path.join(spack_root, 'share', 'spack', 'docker') os_container_mapping_path = os.path.join( share_path, 'os-container-mapping.yaml') with open(os_container_mapping_path, 'r') as fin: os_container_mapping = syaml.load(fin) try: validate(os_container_mapping, mapping_schema) except ValidationError as val_err: tty.error('Ill-formed os-container-mapping configuration object') tty.error(os_container_mapping) tty.debug(val_err) return containers = os_container_mapping['containers'] if args.specs: # Just print out the spec labels and all dependency edges in # a json format. spec_list = [Spec(s) for s in args.specs] with open(args.specs_deps_output, 'w') as out: compute_spec_deps(spec_list, out) return current_system = sys_type() if args.resolve_deps_locally else None release_specs_path = args.spec_set if not release_specs_path: raise SpackError('Must provide path to release spec-set') release_spec_set = CombinatorialSpecSet.from_file(release_specs_path) mirror_url = args.mirror_url if not mirror_url: raise SpackError('Must provide url of target binary mirror') cdash_url = args.cdash_url spec_labels, dependencies, stages = stage_spec_jobs( release_spec_set, containers, current_system) if not stages: tty.msg('No jobs staged, exiting.') return if args.print_summary: print_staging_summary(spec_labels, dependencies, stages) output_object = {} job_count = 0 stage_names = ['stage-{0}'.format(i) for i in range(len(stages))] stage = 0 for stage_jobs in stages: stage_name = stage_names[stage] for spec_label in stage_jobs: release_spec = spec_labels[spec_label]['spec'] root_spec = spec_labels[spec_label]['rootSpec'] pkg_compiler = release_spec.compiler pkg_hash = release_spec.dag_hash() osname = str(release_spec.architecture) job_name = get_job_name(release_spec, osname) container_info = containers[osname] build_image = container_info['image'] job_scripts = ['./bin/rebuild-package.sh'] if 'setup_script' in container_info: job_scripts.insert( 0, container_info['setup_script'] % pkg_compiler) job_dependencies = [] if spec_label in dependencies: job_dependencies = ( [get_job_name(spec_labels[dep_label]['spec'], osname) for dep_label in dependencies[spec_label]]) job_object = { 'stage': stage_name, 'variables': { 'MIRROR_URL': mirror_url, 'CDASH_BASE_URL': cdash_url, 'HASH': pkg_hash, 'DEPENDENCIES': ';'.join(job_dependencies), 'ROOT_SPEC': str(root_spec), }, 'script': job_scripts, 'image': build_image, 'artifacts': { 'paths': [ 'local_mirror/build_cache', 'jobs_scratch_dir', 'cdash_report', ], 'when': 'always', }, 'dependencies': job_dependencies, } # If we see 'compilers' in the container iformation, it's a # filter for the compilers this container can handle, else we # assume it can handle any compiler if 'compilers' in container_info: do_job = False for item in container_info['compilers']: container_compiler_spec = CompilerSpec(item['name']) if pkg_compiler == container_compiler_spec: do_job = True else: do_job = True if args.shared_runner_tag: job_object['tags'] = [args.shared_runner_tag] if args.signing_key: job_object['variables']['SIGN_KEY_HASH'] = args.signing_key if do_job: output_object[job_name] = job_object job_count += 1 stage += 1 tty.msg('{0} build jobs generated in {1} stages'.format( job_count, len(stages))) final_stage = 'stage-rebuild-index' final_job = { 'stage': final_stage, 'variables': { 'MIRROR_URL': mirror_url, }, 'image': build_image, 'script': './bin/rebuild-index.sh', } if args.shared_runner_tag: final_job['tags'] = [args.shared_runner_tag] output_object['rebuild-index'] = final_job stage_names.append(final_stage) output_object['stages'] = stage_names with open(args.output_file, 'w') as outf: outf.write(syaml.dump(output_object))
def arch(parser, args): if args.platform: print architecture.platform() else: print architecture.sys_type()
def test_specs_staging(config): """Make sure we achieve the best possible staging for the following spec DAG:: a /| c b |\ e d |\ f g In this case, we would expect 'c', 'e', 'f', and 'g' to be in the first stage, and then 'd', 'b', and 'a' to be put in the next three stages, respectively. """ current_system = sys_type() config_compilers = config.get_config('compilers') first_compiler = config_compilers[0] compiler_spec = first_compiler['compiler']['spec'] # Whatever that first compiler in the configuration was, let's make sure # we mock up an entry like we'd find in os-container-mapping.yaml which # has that compiler. mock_containers = {} mock_containers[current_system] = { "image": "dontcare", "compilers": [{ "name": compiler_spec, }], } default = ('build', 'link') g = MockPackage('g', [], []) f = MockPackage('f', [], []) e = MockPackage('e', [], []) d = MockPackage('d', [f, g], [default, default]) c = MockPackage('c', [], []) b = MockPackage('b', [d, e], [default, default]) a = MockPackage('a', [b, c], [default, default]) mock_repo = MockPackageMultiRepo([a, b, c, d, e, f, g]) with repo.swap(mock_repo): # Now we'll ask for the root package to be compiled with whatever that # first compiler in the configuration was. spec_a = Spec('a%{0}'.format(compiler_spec)) spec_a.concretize() spec_a_label = spec_deps_key_label(spec_a)[1] spec_b_label = spec_deps_key_label(spec_a['b'])[1] spec_c_label = spec_deps_key_label(spec_a['c'])[1] spec_d_label = spec_deps_key_label(spec_a['d'])[1] spec_e_label = spec_deps_key_label(spec_a['e'])[1] spec_f_label = spec_deps_key_label(spec_a['f'])[1] spec_g_label = spec_deps_key_label(spec_a['g'])[1] spec_labels, dependencies, stages = stage_spec_jobs([spec_a], mock_containers, current_system) assert (len(stages) == 4) assert (len(stages[0]) == 4) assert (spec_c_label in stages[0]) assert (spec_e_label in stages[0]) assert (spec_f_label in stages[0]) assert (spec_g_label in stages[0]) assert (len(stages[1]) == 1) assert (spec_d_label in stages[1]) assert (len(stages[2]) == 1) assert (spec_b_label in stages[2]) assert (len(stages[3]) == 1) assert (spec_a_label in stages[3])