forked from spack/spack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first set of work to allow for saving local results with spack monitor (
spack#23804) This work will come in two phases. The first here is to allow saving of a local result with spack monitor, and the second will add a spack monitor command so the user can do spack monitor upload. Signed-off-by: vsoch <vsoch@users.noreply.github.com> Co-authored-by: vsoch <vsoch@users.noreply.github.com>
- Loading branch information
Showing
6 changed files
with
156 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other | ||
# Spack Project Developers. See the top-level COPYRIGHT file for details. | ||
# | ||
# SPDX-License-Identifier: (Apache-2.0 OR MIT) | ||
|
||
import spack.config | ||
import spack.spec | ||
from spack.main import SpackCommand | ||
import pytest | ||
import os | ||
|
||
install = SpackCommand('install') | ||
|
||
|
||
@pytest.fixture(scope='session') | ||
def test_install_monitor_save_local(install_mockery_mutable_config, | ||
mock_fetch, tmpdir_factory): | ||
""" | ||
Mock installing and saving monitor results to file. | ||
""" | ||
reports_dir = tmpdir_factory.mktemp('reports') | ||
spack.config.set('config:monitor_dir', str(reports_dir)) | ||
out = install('--monitor', '--monitor-save-local', 'dttop') | ||
assert "Successfully installed dttop" in out | ||
|
||
# The reports directory should not be empty (timestamped folders) | ||
assert os.listdir(str(reports_dir)) | ||
|
||
# Get the spec name | ||
spec = spack.spec.Spec("dttop") | ||
spec.concretize() | ||
full_hash = spec.full_hash() | ||
|
||
# Ensure we have monitor results saved | ||
for dirname in os.listdir(str(reports_dir)): | ||
dated_dir = os.path.join(str(reports_dir), dirname) | ||
build_metadata = "build-metadata-%s.json" % full_hash | ||
assert build_metadata in os.listdir(dated_dir) | ||
spec_file = "spec-dttop-%s-config.json" % spec.version | ||
assert spec_file in os.listdir(dated_dir) | ||
|
||
spack.config.set('config:monitor_dir', "~/.spack/reports/monitor") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters