Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check forked process calls for success during app installation. #302

Merged
merged 1 commit into from
Jul 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion aiidalab/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,8 @@ def _pip_install(*args, stdout):
process = run_pip_install(*args, python_bin=python_bin)
for line in io.TextIOWrapper(process.stdout, encoding="utf-8"):
stdout.write(line)
if process.returncode != 0:
raise RuntimeError("Failed to install dependencies.")

# AiiDA plugins require reentry run to be found by AiiDA.
process = run_reentry_scan()
Expand All @@ -280,6 +282,8 @@ def _pip_install(*args, stdout):
process = run_verdi_daemon_restart()
for line in io.TextIOWrapper(process.stdout, encoding="utf-8"):
stdout.write(line)
if process.returncode != 0:
raise RuntimeError("Failed to restart verdi daemon.")

for path in (self.path.joinpath(".aiidalab"), self.path):
if path.exists():
Expand Down Expand Up @@ -312,7 +316,8 @@ def _post_install_triggers(self):
# detachment of child processes. For example, an app might trigger
# a background process that is supposed to finish after the
# installation is technically completed.
run_post_install_script(post_install_file)
if run_post_install_script(post_install_file).returncode != 0:
raise CalledProcessError

def _install_from_path(self, path):
if path.is_dir():
Expand Down
2 changes: 0 additions & 2 deletions aiidalab/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ def this_or_only_subdir(path):
def run_pip_install(*args, python_bin=sys.executable):
return subprocess.Popen(
[python_bin, "-m", "pip", "install", *args],
bufsize=1,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
Expand All @@ -219,7 +218,6 @@ def run_reentry_scan():
def run_verdi_daemon_restart():
return subprocess.Popen(
["verdi", "daemon", "restart"],
bufsize=1,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
Expand Down