util

package
v0.0.0-...-33ed98b Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package util provides utility methods for the agent.

Index

Constants

View Source
const (
	MarkerTaskID      = "EVR_TASK_ID"
	MarkerAgentPID    = "EVR_AGENT_PID"
	MarkerInEvergreen = "IN_EVERGREEN"
)

Variables

View Source
var ErrPSTimeout = errors.New("ps timeout")

Functions

func GetEC2InstanceID

func GetEC2InstanceID(ctx context.Context) (string, error)

GetEC2InstanceID returns the instance ID from the metadata endpoint if it's an EC2 instance.

func KillSpawnedProcs

func KillSpawnedProcs(ctx context.Context, key, workingDir string, logger grip.Journaler) error

KillSpawnedProcs kills processes that descend from the agent and waits for them to terminate.

func S3DefaultURL

func S3DefaultURL(bucket, key string) string

S3DefaultURL returns the S3 URL for the given bucket containing the object key. The style of the S3 URL is determined based on the bucket name.

func S3PathURL

func S3PathURL(bucket, key string) string

S3PathURL returns the path-style S3 URL for the given bucket containing the object key.

func S3VirtualHostedURL

func S3VirtualHostedURL(bucket, key string) string

S3VirtualHostedURL returns the virtual hosted-style S3 URL for the given bucket containing the object key.

func TrackProcess

func TrackProcess(key string, pid int, logger grip.Journaler)

TrackProcess is a noop by default if we don't need to do any special bookkeeping up-front.

Types

type DynamicExpansions

type DynamicExpansions struct {
	util.Expansions
	// contains filtered or unexported fields
}

DynamicExpansions wraps expansions for safe concurrent access as they are dynamically updated.

This should be expanded to support better expansion handling during a task run.

func NewDynamicExpansions

func NewDynamicExpansions(e util.Expansions) *DynamicExpansions

func (*DynamicExpansions) Get

func (e *DynamicExpansions) Get(key string) string

func (*DynamicExpansions) Put

func (e *DynamicExpansions) Put(key, value string)

func (*DynamicExpansions) Update

func (e *DynamicExpansions) Update(newExpansions map[string]string)

func (*DynamicExpansions) UpdateFromYaml

func (e *DynamicExpansions) UpdateFromYaml(filename string) error

Jump to

Keyboard shortcuts

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