Commit 7396fc84 authored by Lorenz Huedepohl's avatar Lorenz Huedepohl
Browse files

Add temptative python repository support

parent 3832f06a
......@@ -125,6 +125,7 @@ def mpcdf_enable_repositories(api_url, project, package, verbose=False):
all_compilers = get_attribute_values(api_url, project, None, "MPCDF:compiler_modules")
mpis = get_attribute_values(api_url, project, package, "MPCDF:mpi_modules", with_project=True)
cudas = get_attribute_values(api_url, project, package, "MPCDF:cuda_modules", with_project=True)
pythons = get_attribute_values(api_url, project, package, "MPCDF:python_modules", with_project=True)
def enable(name):
node = ElementTree.Element("enable")
......@@ -169,6 +170,9 @@ def mpcdf_enable_repositories(api_url, project, package, verbose=False):
for mpi in mpis:
if valid_mpi(compiler, mpi):
enable(cuda + "_" + mpi + "_" + compiler)
if flag == "python":
for python in pythons:
enable(python)
if len(build.getchildren()) > 0:
build.getchildren()[-1].tail = "\n "
......@@ -188,6 +192,7 @@ def mpcdf_setup_repositories(api_url, project, distribution=None, parent=None, p
compilers = list(get_attribute_values(api_url, project, None, "MPCDF:compiler_modules"))
mpis = list(get_attribute_values(api_url, project, None, "MPCDF:mpi_modules"))
cudas = list(get_attribute_values(api_url, project, None, "MPCDF:cuda_modules"))
pythons = list(get_attribute_values(api_url, project, None, "MPCDF:python_modules"))
if distribution is None:
# Get existing value from project meta
......@@ -231,10 +236,12 @@ def mpcdf_setup_repositories(api_url, project, distribution=None, parent=None, p
is_mpi = kwargs.pop("mpi", False)
is_cuda = kwargs.pop("cuda", False)
is_cuda_mpi = kwargs.pop("cuda_mpi", False)
is_python = kwargs.pop("python", False)
have_compiler = is_compiler or is_mpi or is_cuda or is_cuda_mpi
have_mpi = is_mpi or is_cuda_mpi
have_cuda = is_cuda or is_cuda_mpi
have_python = is_python
if kwargs:
raise Exception("Invalid argument")
......@@ -267,10 +274,12 @@ def mpcdf_setup_repositories(api_url, project, distribution=None, parent=None, p
prjconf.append("%is_mpi_repository {0}".format(1 if is_mpi else 0))
prjconf.append("%is_cuda_repository {0}".format(1 if is_cuda else 0))
prjconf.append("%is_cuda_mpi_repository {0}".format(1 if is_cuda_mpi else 0))
prjconf.append("%is_python_repository {0}".format(1 if is_python else 0))
prjconf.append("%have_mpcdf_compiler {0}".format(1 if have_compiler else 0))
prjconf.append("%have_mpcdf_mpi {0}".format(1 if have_mpi else 0))
prjconf.append("%have_mpcdf_cuda {0}".format(1 if have_cuda else 0))
prjconf.append("%have_mpcdf_python {0}".format(1 if have_python else 0))
prjconf.append(":Macros")
prjconf.append("%endif")
......@@ -296,6 +305,9 @@ def mpcdf_setup_repositories(api_url, project, distribution=None, parent=None, p
(project, mpi + "_" + compiler),
cuda_mpi=True)
for python in pythons:
repo(python, (project, "System"), python=True)
# Remove build configuration
build = root.find("./build")
if build is None:
......
......@@ -18,9 +18,11 @@ import osc.cmdln
help="Restrict the set of MPI implementations to use")
@osc.cmdln.option('--cuda-modules', nargs=1,
help="Restrict the set of CUDA implementations to use")
@osc.cmdln.option('--python-modules', nargs=1,
help="Restrict the set of Python implementations to use")
@osc.cmdln.option('--set', nargs=1, metavar="FLAGS",
help="Modify the set of enabled repositories, without this the current setup is displayed. "
"FLAGS is a comma-separated list of a subset of 'system', 'compilers', 'mpi', 'cuda_mpi'")
"FLAGS is a comma-separated list of a subset of 'system', 'compilers', 'mpi', 'cuda_mpi', 'python'")
@osc.cmdln.alias("mpcdf_enable_repos")
def do_mpcdf_enable_repositories(self, subcmd, opts, *args):
"""${cmd_name}: Select all appropriate repositories for an MPCDF package
......@@ -78,11 +80,12 @@ def do_mpcdf_enable_repositories(self, subcmd, opts, *args):
set_or_remove(opts.mpi_modules, "MPCDF:mpi_modules")
set_or_remove(opts.cuda_modules, "MPCDF:cuda_modules")
set_or_remove(opts.python_modules, "MPCDF:python_modules")
set_or_remove(opts.compiler_modules, "MPCDF:compiler_modules")
if opts.recreate or opts.set:
mpcdf_common.mpcdf_enable_repositories(api_url, project, package, verbose=True)
elif (opts.compiler_modules or opts.mpi_modules or opts.cuda_modules):
elif (opts.compiler_modules or opts.mpi_modules or opts.cuda_modules or opts.python_modules):
print("ERROR: Invalid arguments, try --help")
else:
try:
......@@ -102,3 +105,4 @@ def do_mpcdf_enable_repositories(self, subcmd, opts, *args):
print_attr("- Subset of compiler modules set to:", "MPCDF:compiler_modules")
print_attr("- Subset of MPI modules set to:", "MPCDF:mpi_modules")
print_attr("- Subset of CUDA modules set to:", "MPCDF:cuda_modules")
print_attr("- Subset of Python modules set to:", "MPCDF:python_modules")
......@@ -45,6 +45,7 @@ def do_mpcdf_info(self, subcmd, opts, *args):
print_attribute("Compilers", "MPCDF:compiler_modules")
print_attribute("MPI libraries", "MPCDF:mpi_modules")
print_attribute("CUDA versions", "MPCDF:cuda_modules")
print_attribute("Python versions", "MPCDF:python_modules")
unmanaged = []
......@@ -73,7 +74,8 @@ def do_mpcdf_info(self, subcmd, opts, *args):
print(" " + pkg_name_fmt.format(package), ", ".join(enabled_repos),
subset("compiler subset", "MPCDF:compiler_modules") +
subset("MPI subset", "MPCDF:mpi_modules") +
subset("CUDA subet", "MPCDF:cuda_modules"))
subset("CUDA subset", "MPCDF:cuda_modules") +
subset("Python subset", "MPCDF:python_modules"))
print()
if unmanaged:
......
......@@ -20,8 +20,9 @@ import osc.cmdln
def do_mpcdf_setup_repositories(self, subcmd, opts, *args):
"""${cmd_name}: Create all repository combinations for an MPCDF project
Given a list of compilers, MPI libraries, and possibly CUDA versions, this command
creates repositories for all the resulting combinations
Given a list of compilers, MPI libraries, and possibly CUDA and python
versions from the project attributes, this command creates repositories for
all the resulting combinations
Usage:
osc ${cmd_name} [PROJECT]
......
......@@ -42,7 +42,7 @@ def do_mpcdf_sync_projects(self, subcmd, opts, *args):
from_packages = [package]
to_packages = osc.core.meta_get_packagelist(api_url, to_project)
project_attributes = ["MPCDF:compiler_modules", "MPCDF:cuda_modules", "MPCDF:mpi_modules"]
project_attributes = ["MPCDF:compiler_modules", "MPCDF:cuda_modules", "MPCDF:mpi_modules", "MPCDF:python_modules"]
package_attributes = ["MPCDF:enable_repositories"] + project_attributes
for attribute in project_attributes:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment