Пример #1
0
    def capture_build_environment(self):
        """
        Capture the environment for the build.

        This uses spack.util.environment.get_host_environment_metadata to do so.
        This is important because it's a unique identifier, along with the spec,
        for a Build. It should look something like this:

        {'host_os': 'ubuntu20.04',
         'platform': 'linux',
         'host_target': 'skylake',
         'hostname': 'vanessa-ThinkPad-T490s',
         'spack_version': '0.16.1-1455-52d5b55b65',
         'kernel_version': '#73-Ubuntu SMP Mon Jan 18 17:25:17 UTC 2021'}

        This is saved to a package install's metadata folder as
        install_environment.json, and can be loaded by the monitor for uploading
        data relevant to a later analysis.
        """
        from spack.util.environment import get_host_environment_metadata
        self.build_environment = get_host_environment_metadata()
        keys = list(self.build_environment.keys())

        # Allow to customize any of these values via the environment
        for key in keys:
            envar_name = "SPACKMON_%s" % key.upper()
            envar = os.environ.get(envar_name)
            if envar:
                self.build_environment[key] = envar
Пример #2
0
 def write_host_environment(self, spec):
     """The host environment is a json file with os, kernel, and spack
     versioning. We use it in the case that an analysis later needs to
     easily access this information.
     """
     from spack.util.environment import get_host_environment_metadata
     env_file = self.env_metadata_path(spec)
     environ = get_host_environment_metadata()
     with open(env_file, 'w') as fd:
         sjson.dump(environ, fd)