build

package
v1.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrInvalidJSON         = internal.Error("invalid spack lock JSON")
	ErrEnvironmentBuilding = internal.Error("build already running for environment")

	ErrInvalidEnvPath = internal.Error("invalid environment path")
	ErrInvalidVersion = internal.Error("environment version required")
)
View Source
const (
	ScriptsDirSuffix = "-scripts"
	ErrMakeDirectory = internal.Error("base not parent of leaf")
)
View Source
const (
	ErrBuildFailed = "environment build failed"
)

Variables

This section is empty.

Functions

func ModuleDirFromName added in v1.3.0

func ModuleDirFromName(moduleInstallBase, path, name string) string

ModuleDirFromName returns the canonical module path for an environment.

func ScriptsDirFromNameAndVersion added in v1.3.0

func ScriptsDirFromNameAndVersion(scriptInstallBase, path, name, version string) string

ScriptsDirFromNameAndVersion returns the canonical scripts path for an environment.

func SpackLockToSoftPackYML

func SpackLockToSoftPackYML(spackLockData []byte, desc string, exes []string) (string, error)

SpackLockToSoftPackYML uses the given spackLockData to generate a disambiguated softpack.yml file.

The format of the file is as follows: description: |

$desc
The following executables are added to your PATH:
  - supplied_executable_1
  - supplied_executable_2
  - ...

packages:

  • supplied_package_1@v1
  • supplied_package_2@v1.1
  • ...

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder lets you do builds given config, S3 and a wr runner.

func New

func New(config *config.Config, s3helper S3, runner Runner) (*Builder, error)

New takes the s3 build cache URL, the repo and checkout reference of your custom spack repo, and returns a Builder. Optionally, supply objects that satisfy the S3 and Runner interfaces; if nil, these default to using the s3 and wr packages.

func (*Builder) Build

func (b *Builder) Build(def *Definition) (err error)

Build uploads a singularity.def generated by GenerateSingularityDef() to S3 and adds a job to wr to build the image. You'll need a wr manager running that can run jobs with root and access the S3, ie. a cloud deployment.

func (*Builder) SetPostBuildCallback added in v1.4.0

func (b *Builder) SetPostBuildCallback(cb func())

SetPostBuildCallback causes the passed callback to be called after the spack-related parts of a build have completed.

func (*Builder) Status added in v1.5.0

func (b *Builder) Status() []Status

Status returns the status of all known builds.

type ConcreteSpec

type ConcreteSpec struct {
	Name, Version string
}

type Definition

type Definition struct {
	EnvironmentPath    string
	EnvironmentName    string
	EnvironmentVersion string
	Description        string
	Packages           core.Packages
}

Definition describes the environment a user wanted to create, which comprises a EnvironmentPath such as "users/username", and EnvironmentName such as "mainpackage", and EnvironmentVersion, such as "1". The given Packages will be installed for this Environment, and the Description will become the help text for making use of the Packages.

func (*Definition) FullEnvironmentPath

func (d *Definition) FullEnvironmentPath() string

FullEnvironmentPath returns the complete environment path: the location under environments in the environments git repository that the artefacts will be stored.

func (*Definition) Interpreters added in v1.1.0

func (d *Definition) Interpreters() []string

Interpreters returns interpreter executable names required by interpreter-specific packages.

func (*Definition) ModuleUsage

func (d *Definition) ModuleUsage(loadPath string) string

ModuleUsage returns a markdown formatted usage that tells a user to module load our environment installed in the given loadPath.

func (*Definition) ToModule

func (d *Definition) ToModule(installDir string, deps, exes []string) string

ToModule creates a tcl module based on our packages, and uses installDir to prepend a PATH for the exe wrapper scripts that will be at the installed location of the module. Any supplied module dependencies will be module loaded.

func (*Definition) Validate added in v1.1.0

func (d *Definition) Validate() error

Validate returns an error if the Path is invalid, if Version isn't set, if there are no packages defined, or if any package has no name.

type Runner added in v1.5.0

type Runner interface {
	Add(deployment string) (string, error)
	WaitForRunning(id string) error
	Wait(id string) (wr.WRJobStatus, error)
	Status(id string) (wr.WRJobStatus, error)
}

type S3 added in v1.5.0

type S3 interface {
	UploadData(data io.Reader, dest string) error
	OpenFile(source string) (io.ReadCloser, error)
}

type SpackLock

type SpackLock struct {
	Roots []struct {
		Hash, Spec string
	}
	ConcreteSpecs map[string]ConcreteSpec `json:"concrete_specs"`
}

type Status added in v1.5.0

type Status struct {
	Name       string
	Requested  *time.Time
	BuildStart *time.Time
	BuildDone  *time.Time
}

The status of an individual build – when it was requested, when it started actually being built, and when its build finished.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL