cleanup from debugging
This commit is contained in:
parent
f1638365a9
commit
e687bb902f
@ -44,7 +44,7 @@
|
|||||||
import llnl.util.lock as lk
|
import llnl.util.lock as lk
|
||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
from llnl.string import ordinal
|
from llnl.string import ordinal
|
||||||
from llnl.util.lang import nullcontext, pretty_seconds
|
from llnl.util.lang import pretty_seconds
|
||||||
from llnl.util.tty.color import colorize
|
from llnl.util.tty.color import colorize
|
||||||
from llnl.util.tty.log import log_output
|
from llnl.util.tty.log import log_output
|
||||||
|
|
||||||
@ -980,9 +980,6 @@ def __init__(
|
|||||||
# initialize cache variables
|
# initialize cache variables
|
||||||
self._install_action = None
|
self._install_action = None
|
||||||
|
|
||||||
# context to allow overwriting
|
|
||||||
self.context = nullcontext()
|
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
"""Start the work of this task."""
|
"""Start the work of this task."""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
@ -1125,7 +1122,6 @@ def get_install_action(self: "Task") -> InstallAction:
|
|||||||
installation should proceed as normal (i.e. no need to transactionally
|
installation should proceed as normal (i.e. no need to transactionally
|
||||||
preserve the old prefix).
|
preserve the old prefix).
|
||||||
"""
|
"""
|
||||||
print(self.request.overwrite)
|
|
||||||
# If we don't have to overwrite, do a normal install
|
# If we don't have to overwrite, do a normal install
|
||||||
if self.pkg.spec.dag_hash() not in self.request.overwrite:
|
if self.pkg.spec.dag_hash() not in self.request.overwrite:
|
||||||
return InstallAction.INSTALL
|
return InstallAction.INSTALL
|
||||||
@ -1240,9 +1236,6 @@ def start(self):
|
|||||||
|
|
||||||
Otherwise, start a process for of the requested spec and/or
|
Otherwise, start a process for of the requested spec and/or
|
||||||
dependency represented by the BuildTask."""
|
dependency represented by the BuildTask."""
|
||||||
for a, b, c in os.walk(self.pkg.prefix):
|
|
||||||
print("start", a, b, c)
|
|
||||||
|
|
||||||
if self.install_action == InstallAction.OVERWRITE:
|
if self.install_action == InstallAction.OVERWRITE:
|
||||||
self.tmpdir = tempfile.mkdtemp(dir=os.path.dirname(self.pkg.prefix), prefix=".backup")
|
self.tmpdir = tempfile.mkdtemp(dir=os.path.dirname(self.pkg.prefix), prefix=".backup")
|
||||||
self.backup_dir = os.path.join(self.tmpdir, "backup")
|
self.backup_dir = os.path.join(self.tmpdir, "backup")
|
||||||
@ -1271,9 +1264,6 @@ def start(self):
|
|||||||
else:
|
else:
|
||||||
tty.msg(f"No binary for {pkg_id} found: installing from source")
|
tty.msg(f"No binary for {pkg_id} found: installing from source")
|
||||||
|
|
||||||
for a, b, c in os.walk(self.pkg.prefix):
|
|
||||||
print("start2", a, b, c)
|
|
||||||
|
|
||||||
# if there's an error result, don't start a new process, and leave
|
# if there's an error result, don't start a new process, and leave
|
||||||
if self.error_result is not None:
|
if self.error_result is not None:
|
||||||
return
|
return
|
||||||
@ -1283,9 +1273,6 @@ def start(self):
|
|||||||
pkg.stage
|
pkg.stage
|
||||||
self._setup_install_dir(pkg)
|
self._setup_install_dir(pkg)
|
||||||
|
|
||||||
for a, b, c in os.walk(self.pkg.prefix):
|
|
||||||
print("start3", a, b, c)
|
|
||||||
|
|
||||||
# Create a child process to do the actual installation.
|
# Create a child process to do the actual installation.
|
||||||
self.process_handle = spack.build_environment.start_build_process(
|
self.process_handle = spack.build_environment.start_build_process(
|
||||||
self.pkg, build_process, self.request.install_args
|
self.pkg, build_process, self.request.install_args
|
||||||
@ -1335,7 +1322,6 @@ def complete(self):
|
|||||||
pkg = self.pkg
|
pkg = self.pkg
|
||||||
tests = install_args.get("tests")
|
tests = install_args.get("tests")
|
||||||
|
|
||||||
print("error result in complete", self.error_result)
|
|
||||||
self.status = BuildStatus.INSTALLING
|
self.status = BuildStatus.INSTALLING
|
||||||
|
|
||||||
pkg.run_tests = tests is True or tests and pkg.name in tests
|
pkg.run_tests = tests is True or tests and pkg.name in tests
|
||||||
@ -1365,7 +1351,6 @@ def complete(self):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
# Check if the task's child process has completed
|
# Check if the task's child process has completed
|
||||||
print("error result in completei 3", self.error_result)
|
|
||||||
spack.package_base.PackageBase._verbose = self.process_handle.complete()
|
spack.package_base.PackageBase._verbose = self.process_handle.complete()
|
||||||
# Note: PARENT of the build process adds the new package to
|
# Note: PARENT of the build process adds the new package to
|
||||||
# the database, so that we don't need to re-read from file.
|
# the database, so that we don't need to re-read from file.
|
||||||
@ -1940,7 +1925,6 @@ def _complete_task(self, task: Task, install_status: InstallStatus) -> None:
|
|||||||
install_status: the installation status for the package
|
install_status: the installation status for the package
|
||||||
"""
|
"""
|
||||||
rc = task.complete()
|
rc = task.complete()
|
||||||
task.context.__exit__()
|
|
||||||
if rc == ExecuteResult.MISSING_BUILD_SPEC:
|
if rc == ExecuteResult.MISSING_BUILD_SPEC:
|
||||||
self._requeue_with_build_spec_tasks(task)
|
self._requeue_with_build_spec_tasks(task)
|
||||||
elif rc == ExecuteResult.NO_OP:
|
elif rc == ExecuteResult.NO_OP:
|
||||||
@ -2191,17 +2175,11 @@ def start_task(
|
|||||||
self, task: Task, install_status: InstallStatus, term_status: TermStatusLine
|
self, task: Task, install_status: InstallStatus, term_status: TermStatusLine
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Attempts to start a package installation."""
|
"""Attempts to start a package installation."""
|
||||||
for a, b, c in os.walk(task.pkg.prefix):
|
|
||||||
print("start_task", a, b, c)
|
|
||||||
|
|
||||||
pkg, pkg_id, spec = task.pkg, task.pkg_id, task.pkg.spec
|
pkg, pkg_id, spec = task.pkg, task.pkg_id, task.pkg.spec
|
||||||
install_status.next_pkg(pkg)
|
install_status.next_pkg(pkg)
|
||||||
# install_status.set_term_title(f"Processing {task.pkg.name}")
|
# install_status.set_term_title(f"Processing {task.pkg.name}")
|
||||||
tty.debug(f"Processing {pkg_id}: task={task}")
|
tty.debug(f"Processing {pkg_id}: task={task}")
|
||||||
|
|
||||||
for a, b, c in os.walk(task.pkg.prefix):
|
|
||||||
print("2", a, b, c)
|
|
||||||
|
|
||||||
# Skip the installation if the spec is not being installed locally
|
# Skip the installation if the spec is not being installed locally
|
||||||
# (i.e., if external or upstream) BUT flag it as installed since
|
# (i.e., if external or upstream) BUT flag it as installed since
|
||||||
# some package likely depends on it.
|
# some package likely depends on it.
|
||||||
@ -2210,8 +2188,6 @@ def start_task(
|
|||||||
self._flag_installed(pkg, task.dependents)
|
self._flag_installed(pkg, task.dependents)
|
||||||
task.no_op = True
|
task.no_op = True
|
||||||
return
|
return
|
||||||
for a, b, c in os.walk(task.pkg.prefix):
|
|
||||||
print("3", a, b, c)
|
|
||||||
|
|
||||||
# Flag a failed spec. Do not need an (install) prefix lock since
|
# Flag a failed spec. Do not need an (install) prefix lock since
|
||||||
# assume using a separate (failed) prefix lock file.
|
# assume using a separate (failed) prefix lock file.
|
||||||
@ -2223,9 +2199,6 @@ def start_task(
|
|||||||
if self.fail_fast:
|
if self.fail_fast:
|
||||||
task.error_result = spack.error.InstallError(_fail_fast_err, pkg=pkg)
|
task.error_result = spack.error.InstallError(_fail_fast_err, pkg=pkg)
|
||||||
|
|
||||||
for a, b, c in os.walk(task.pkg.prefix):
|
|
||||||
print("4", a, b, c)
|
|
||||||
|
|
||||||
# Attempt to get a write lock. If we can't get the lock then
|
# Attempt to get a write lock. If we can't get the lock then
|
||||||
# another process is likely (un)installing the spec or has
|
# another process is likely (un)installing the spec or has
|
||||||
# determined the spec has already been installed (though the
|
# determined the spec has already been installed (though the
|
||||||
@ -2245,8 +2218,6 @@ def start_task(
|
|||||||
self._requeue_task(task, install_status)
|
self._requeue_task(task, install_status)
|
||||||
task.no_op = True
|
task.no_op = True
|
||||||
return
|
return
|
||||||
for a, b, c in os.walk(task.pkg.prefix):
|
|
||||||
print("5", a, b, c)
|
|
||||||
|
|
||||||
term_status.clear()
|
term_status.clear()
|
||||||
|
|
||||||
@ -2255,13 +2226,8 @@ def start_task(
|
|||||||
if task.request.overwrite and task.explicit:
|
if task.request.overwrite and task.explicit:
|
||||||
task.request.overwrite_time = time.time()
|
task.request.overwrite_time = time.time()
|
||||||
|
|
||||||
for a, b, c in os.walk(task.pkg.prefix):
|
|
||||||
print("6", a, b, c)
|
|
||||||
# Determine state of installation artifacts and adjust accordingly.
|
|
||||||
# install_status.set_term_title(f"Preparing {task.pkg.name}")
|
# install_status.set_term_title(f"Preparing {task.pkg.name}")
|
||||||
self._prepare_for_install(task)
|
self._prepare_for_install(task)
|
||||||
for a, b, c in os.walk(task.pkg.prefix):
|
|
||||||
print("7", a, b, c)
|
|
||||||
|
|
||||||
# Flag an already installed package
|
# Flag an already installed package
|
||||||
if pkg_id in self.installed:
|
if pkg_id in self.installed:
|
||||||
@ -2287,9 +2253,6 @@ def start_task(
|
|||||||
task.no_op = True
|
task.no_op = True
|
||||||
return
|
return
|
||||||
|
|
||||||
for a, b, c in os.walk(task.pkg.prefix):
|
|
||||||
print("8", a, b, c)
|
|
||||||
|
|
||||||
# Having a read lock on an uninstalled pkg may mean another
|
# Having a read lock on an uninstalled pkg may mean another
|
||||||
# process completed an uninstall of the software between the
|
# process completed an uninstall of the software between the
|
||||||
# time we failed to acquire the write lock and the time we
|
# time we failed to acquire the write lock and the time we
|
||||||
@ -2304,9 +2267,6 @@ def start_task(
|
|||||||
task.no_op = True
|
task.no_op = True
|
||||||
return
|
return
|
||||||
|
|
||||||
for a, b, c in os.walk(task.pkg.prefix):
|
|
||||||
print("9", a, b, c)
|
|
||||||
|
|
||||||
# Proceed with the installation since we have an exclusive write
|
# Proceed with the installation since we have an exclusive write
|
||||||
# lock on the package.
|
# lock on the package.
|
||||||
install_status.set_term_title(f"Installing {task.pkg.name}")
|
install_status.set_term_title(f"Installing {task.pkg.name}")
|
||||||
@ -2317,9 +2277,6 @@ def start_task(
|
|||||||
task.start()
|
task.start()
|
||||||
tty.msg(install_msg(pkg_id, self.pid, install_status))
|
tty.msg(install_msg(pkg_id, self.pid, install_status))
|
||||||
|
|
||||||
for a, b, c in os.walk(task.pkg.prefix):
|
|
||||||
print("10", a, b, c)
|
|
||||||
|
|
||||||
def complete_task(self, task: Task, install_status: InstallStatus) -> Optional[Tuple]:
|
def complete_task(self, task: Task, install_status: InstallStatus) -> Optional[Tuple]:
|
||||||
"""Attempts to complete a package installation."""
|
"""Attempts to complete a package installation."""
|
||||||
pkg, pkg_id = task.pkg, task.pkg_id
|
pkg, pkg_id = task.pkg, task.pkg_id
|
||||||
@ -2371,7 +2328,7 @@ def complete_task(self, task: Task, install_status: InstallStatus) -> Optional[T
|
|||||||
except (Exception, SystemExit) as exc:
|
except (Exception, SystemExit) as exc:
|
||||||
# Overwrite process exception handling
|
# Overwrite process exception handling
|
||||||
self._update_failed(task, True, exc)
|
self._update_failed(task, True, exc)
|
||||||
print("HEHEREHERERES")
|
|
||||||
# Best effort installs suppress the exception and mark the
|
# Best effort installs suppress the exception and mark the
|
||||||
# package as a failure.
|
# package as a failure.
|
||||||
if not isinstance(exc, spack.error.SpackError) or not exc.printed: # type: ignore[union-attr] # noqa: E501
|
if not isinstance(exc, spack.error.SpackError) or not exc.printed: # type: ignore[union-attr] # noqa: E501
|
||||||
@ -2389,7 +2346,6 @@ def complete_task(self, task: Task, install_status: InstallStatus) -> Optional[T
|
|||||||
# Terminate when a single build request has failed, or summarize errors later.
|
# Terminate when a single build request has failed, or summarize errors later.
|
||||||
if task.is_build_request:
|
if task.is_build_request:
|
||||||
if len(self.build_requests) == 1:
|
if len(self.build_requests) == 1:
|
||||||
print("1")
|
|
||||||
raise
|
raise
|
||||||
return (pkg, pkg_id, str(exc))
|
return (pkg, pkg_id, str(exc))
|
||||||
|
|
||||||
@ -2445,13 +2401,7 @@ def install(self) -> None:
|
|||||||
for task in done:
|
for task in done:
|
||||||
try:
|
try:
|
||||||
# If complete_task does not return None, the build request failed
|
# If complete_task does not return None, the build request failed
|
||||||
print(
|
|
||||||
"install_status when passed to complete_task",
|
|
||||||
install_status,
|
|
||||||
type(install_status),
|
|
||||||
)
|
|
||||||
failure = self.complete_task(task, install_status)
|
failure = self.complete_task(task, install_status)
|
||||||
print("COMPLETED WITH FAILURE", failure)
|
|
||||||
if failure:
|
if failure:
|
||||||
failed_build_requests.append(failure)
|
failed_build_requests.append(failure)
|
||||||
except Exception:
|
except Exception:
|
||||||
@ -2499,7 +2449,6 @@ def install(self) -> None:
|
|||||||
]
|
]
|
||||||
|
|
||||||
if failed_build_requests or missing:
|
if failed_build_requests or missing:
|
||||||
print("BBBBBBB")
|
|
||||||
for _, pkg_id, err in failed_build_requests:
|
for _, pkg_id, err in failed_build_requests:
|
||||||
tty.error(f"{pkg_id}: {err}")
|
tty.error(f"{pkg_id}: {err}")
|
||||||
|
|
||||||
@ -2521,6 +2470,7 @@ def install(self) -> None:
|
|||||||
"Associating installation failure with first "
|
"Associating installation failure with first "
|
||||||
f"missing package ({ids[0]}) from {', '.join(ids)}"
|
f"missing package ({ids[0]}) from {', '.join(ids)}"
|
||||||
)
|
)
|
||||||
|
|
||||||
raise spack.error.InstallError(
|
raise spack.error.InstallError(
|
||||||
"Installation request failed. Refer to reported errors for failing package(s).",
|
"Installation request failed. Refer to reported errors for failing package(s).",
|
||||||
pkg=pkg,
|
pkg=pkg,
|
||||||
|
Loading…
Reference in New Issue
Block a user