Skip to content

Commit

Permalink
Remove CombinatorialSpecSet in favor of environments + stacks
Browse files Browse the repository at this point in the history
  • Loading branch information
scottwittenburg authored and tgamblin committed Sep 14, 2019
1 parent 0b67f30 commit 5323a5c
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 721 deletions.
16 changes: 0 additions & 16 deletions etc/spack/defaults/release.yaml

This file was deleted.

21 changes: 0 additions & 21 deletions lib/spack/docs/example_files/spec_set.yaml

This file was deleted.

10 changes: 3 additions & 7 deletions lib/spack/spack/cmd/buildcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@
import spack.config
import spack.repo
import spack.store

from spack.error import SpecError
from spack.paths import etc_path
from spack.spec import Spec, save_dependency_spec_yamls
from spack.spec_set import CombinatorialSpecSet

from spack.cmd import display_specs

Expand Down Expand Up @@ -417,10 +414,9 @@ def check_binaries(args):
if args.spec or args.spec_yaml:
specs = [get_concrete_spec(args)]
else:
release_specs_path = os.path.join(
etc_path, 'spack', 'defaults', 'release.yaml')
spec_set = CombinatorialSpecSet.from_file(release_specs_path)
specs = [spec for spec in spec_set]
env = ev.get_env(args, 'buildcache', required=True)
env.concretize()
specs = env.all_specs()

if not specs:
tty.msg('No specs provided, exiting.')
Expand Down
57 changes: 26 additions & 31 deletions lib/spack/spack/cmd/release_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

import json
import sys

from jsonschema import validate, ValidationError
from six import iteritems
from six.moves.urllib.request import build_opener, HTTPHandler, Request
from six.moves.urllib.error import HTTPError, URLError
from six.moves.urllib.parse import urlencode
from six.moves.urllib.request import build_opener, HTTPHandler, Request

import llnl.util.tty as tty

import spack.environment as ev
from spack.dependency import all_deptypes
from spack.error import SpackError
from spack.spec import Spec
from spack.schema.specs_deps import schema as specs_deps_schema
import spack.util.spack_yaml as syaml
Expand Down Expand Up @@ -42,7 +43,7 @@ def setup_parser(subparser):
help="Print summary of staged jobs to standard output")

subparser.add_argument(
'-c', '--cdash-credentials', default=None,
'--cdash-credentials', default=None,
help="Path to file containing CDash authentication token")


Expand All @@ -59,9 +60,9 @@ def _create_buildgroup(opener, headers, url, project, group_name, group_type):
response_code = response.getcode()

if response_code != 200 and response_code != 201:
print('Creating buildgroup failed (response code = {0}'.format(
response_code))
return None
msg = 'Creating buildgroup failed (response code = {0}'.format(
response_code)
raise SpackError(msg)

response_text = response.read()
response_json = json.loads(response_text)
Expand All @@ -71,7 +72,7 @@ def _create_buildgroup(opener, headers, url, project, group_name, group_type):


def populate_buildgroup(job_names, group_name, project, site,
credentials, cdash_url, exit_on_fail=False):
credentials, cdash_url):
url = "{0}/api/v1/buildgroup.php".format(cdash_url)

headers = {
Expand All @@ -88,8 +89,9 @@ def populate_buildgroup(job_names, group_name, project, site,
'Latest')

if not parent_group_id or not group_id:
print('Unable to create or retrieve the build groups')
sys.exit(1)
msg = 'Failed to create or retrieve buildgroups for {0}'.format(
group_name)
raise SpackError(msg)

data = {
'project': project,
Expand All @@ -107,10 +109,10 @@ def populate_buildgroup(job_names, group_name, project, site,
response = opener.open(request)
response_code = response.getcode()

if response_code != 200 and exit_on_fail:
print('Unexpected response ({0}) when populating buildgroup'.format(
response_code))
sys.exit(1)
if response_code != 200:
msg = 'Error response code ({0}) in populate_buildgroup'.format(
response_code)
raise SpackError(msg)


def get_job_name(spec, osarch, build_group):
Expand Down Expand Up @@ -173,24 +175,12 @@ def get_spec_dependencies(specs, deps, spec_labels):


def stage_spec_jobs(specs):
"""Take a set of release specs along with a dictionary describing the
available docker containers and what compilers they have, and generate
a list of "stages", where the jobs in any stage are dependent only on
jobs in previous stages. This allows us to maximize build parallelism
within the gitlab-ci framework.
"""Take a set of release specs and generate a list of "stages", where the
jobs in any stage are dependent only on jobs in previous stages. This
allows us to maximize build parallelism within the gitlab-ci framework.
Arguments:
spec_set (CombinatorialSpecSet): Iterable containing all the specs
to build.
containers (dict): Describes the docker containers available to use
for concretizing specs (and also for the gitlab runners to use
for building packages). The schema can be found at
"lib/spack/spack/schema/os_container_mapping.py"
current_system (string): If provided, this indicates not to use the
containers for concretizing the release specs, but rather just
assume the current system is in the "containers" dictionary. A
SpackError will be raised if the current system is not in that
dictionary.
specs (Iterable): Specs to build
Returns: A tuple of information objects describing the specs, dependencies
and stages:
Expand Down Expand Up @@ -391,6 +381,8 @@ def release_jobs(parser, args):
env = ev.get_env(args, 'release-jobs', required=True)
env.concretize(force=args.force)

# FIXME: What's the difference between one that opens with 'spack'
# and one that opens with 'env'? This will only handle the former.
yaml_root = env.yaml['spack']

if 'gitlab-ci' not in yaml_root:
Expand Down Expand Up @@ -514,8 +506,11 @@ def release_jobs(parser, args):

# Use "all_job_names" to populate the build group for this set
if cdash_auth_token:
populate_buildgroup(all_job_names, build_group, cdash_project,
cdash_site, cdash_auth_token, cdash_url)
try:
populate_buildgroup(all_job_names, build_group, cdash_project,
cdash_site, cdash_auth_token, cdash_url)
except (SpackError, HTTPError, URLError) as err:
tty.warn('Problem populating buildgroup: {0}'.format(err))
else:
tty.warn('Unable to populate buildgroup without CDash credentials')

Expand Down
1 change: 0 additions & 1 deletion lib/spack/spack/schema/cdash.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
properties = {
'cdash': {
'type': 'object',
'default': {},
'additionalProperties': False,
'required': ['build-group', 'url', 'project', 'site'],
'patternProperties': {
Expand Down
3 changes: 0 additions & 3 deletions lib/spack/spack/schema/gitlab_ci.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
properties = {
'gitlab-ci': {
'type': 'object',
'default': {},
'additionalProperties': False,
'required': ['mappings'],
'patternProperties': {
Expand All @@ -25,7 +24,6 @@
'patternProperties': {
r'[\w\d\-_\.]+': {
'type': 'object',
'default': {},
'additionalProperties': False,
'required': ['match', 'runner-attributes'],
'properties': {
Expand All @@ -38,7 +36,6 @@
},
'runner-attributes': {
'type': 'object',
'default': {},
'additionalProperties': True,
'required': ['tags'],
'properties': {
Expand Down
111 changes: 0 additions & 111 deletions lib/spack/spack/schema/spec_set.py

This file was deleted.

Loading

0 comments on commit 5323a5c

Please sign in to comment.