util

package
v1.5.0-alpha12 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2024 License: Apache-2.0 Imports: 41 Imported by: 0

Documentation

Index

Constants

View Source
const AutoDownloadFolderPerm = 0755
View Source
const ESC = 27

Variables

View Source
var Fatal = fatalError
View Source
var LoggingMode = logger.LogModeDefault
View Source
var ShutdownSignals = []os.Signal{
	os.Interrupt,
	syscall.SIGTERM,
}
View Source
var SystemManagerKey = contextKey{/* contains filtered or unexported fields */}
View Source
var TestError error

Functions

func DownloadResultsHandler

func DownloadResultsHandler(
	ctx context.Context,
	cmd *cobra.Command,
	cfg types.Bacalhau,
	apiV2 clientv2.API,
	jobID string,
	downloadSettings *cliflags.DownloaderSettings,
) error

func EnsureValidVersion

func EnsureValidVersion(ctx context.Context, clientVersion, serverVersion *models.BuildVersionInfo) error

func GetAPIClientV2

func GetAPIClientV2(cmd *cobra.Command, cfg types.Bacalhau) (clientv2.API, error)

func GetCleanupManager

func GetCleanupManager(ctx context.Context) *system.CleanupManager

func GetDefaultJobFolder

func GetDefaultJobFolder(jobID string) string

func InjectCleanupManager added in v1.5.0

func InjectCleanupManager(ctx context.Context) context.Context

injects a Cleanup Manager into the context. TODO deprecated this and the CleanupManager.

func Logs

func Logs(cmd *cobra.Command, api clientv2.API, options LogOptions) error

func ReadFromFile added in v1.4.0

func ReadFromFile(path string) ([]byte, error)

func ReadFromStdinIfAvailable

func ReadFromStdinIfAvailable(cmd *cobra.Command) ([]byte, error)

func ReadJobFromUser added in v1.4.0

func ReadJobFromUser(cmd *cobra.Command, args []string) ([]byte, error)

func ReadToken added in v1.2.1

func ReadToken(path string, apiURL string) (*apimodels.HTTPCredential, error)

Read the authorization crdential associated with the passed API base URL. If there is no credential currently stored, ReadToken will return nil with no error.

func SetupConfig added in v1.5.0

func SetupConfig(cmd *cobra.Command) (types.Bacalhau, error)

func SetupConfigType added in v1.5.0

func SetupConfigType(cmd *cobra.Command) (*config.Config, error)

func SetupConfigs added in v1.5.0

func SetupConfigs(cmd *cobra.Command) (types.Bacalhau, *config.Config, error)

func SetupRepo added in v1.5.0

func SetupRepo(cfg types.Bacalhau) (*repo.FsRepo, error)

func SetupRepoConfig added in v1.3.2

func SetupRepoConfig(cmd *cobra.Command) (types.Bacalhau, error)

func UnmarshalBacalhauConfig added in v1.5.0

func UnmarshalBacalhauConfig(cfg *config.Config) (types.Bacalhau, error)

func WriteToken added in v1.2.1

func WriteToken(path, apiURL string, cred *apimodels.HTTPCredential) error

Persistently store the authorization token against the passed API base URL. Callers may pass nil for the credential which will delete any existing stored token.

Types

type LiveTableWriter added in v1.5.0

type LiveTableWriter struct {
	// Out is the writer to write the table to.
	Out io.Writer
	// contains filtered or unexported fields
}

LiveTableWriter is a buffered table writer that updates the terminal. The contents of LiveTableWriter will be flushed on a timed interval or when Flush is called.

func NewLiveTableWriter added in v1.5.0

func NewLiveTableWriter() *LiveTableWriter

NewLiveTableWriter returns a new LiveTableWriter with defaults

func (*LiveTableWriter) Flush added in v1.5.0

func (w *LiveTableWriter) Flush() error

Flush writes out the table and resets the buffer. It should be called after the last call to Write to ensure that any data buffered in the Writer is written to the output. An error is returned if the contents of the buffer cannot be written to the underlying output stream.

func (*LiveTableWriter) Write added in v1.5.0

func (w *LiveTableWriter) Write(buf []byte) (n int, err error)

Write saves the table contents of buf to the writer b. The only errors are ones encountered while writing to the underlying buffer.

type LogOptions added in v1.2.2

type LogOptions struct {
	JobID       string
	ExecutionID string
	Follow      bool
	Tail        bool
}

type Versions added in v1.1.2

type Versions struct {
	ClientVersion *models.BuildVersionInfo `json:"clientVersion,omitempty"`
	ServerVersion *models.BuildVersionInfo `json:"serverVersion,omitempty"`
	LatestVersion *models.BuildVersionInfo `json:"latestVersion,omitempty"`
	UpdateMessage string                   `json:"updateMessage,omitempty"`
}

func GetAllVersions added in v1.1.2

func GetAllVersions(ctx context.Context, cfg types.Bacalhau, api clientv2.API, r *repo.FsRepo) (Versions, error)

Directories

Path Synopsis
Package printer provides functionality for printing job events and progress.
Package printer provides functionality for printing job events and progress.

Jump to

Keyboard shortcuts

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