commands

package
v0.0.0-...-c3186a4 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Package commands contains commands available to ctpu users.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthCommand

AuthCommand constructs the auth subcommand tree.

func ConfigCommand

func ConfigCommand(cfg *config.Config, cli ConfigGcloudCLI) subcommands.Command

ConfigCommand creates the config subcommand.

func ConfigCommandAlias

func ConfigCommandAlias(cfg *config.Config, cli ConfigGcloudCLI) subcommands.Command

ConfigCommandAlias creates an alias to the config command with a shorter name.

func DeleteCommand

func DeleteCommand(cfg *config.Config, tpu DeleteTPUCP, gce DeleteGCECP) subcommands.Command

DeleteCommand creates the delete command.

func DeleteCommandAlias

func DeleteCommandAlias(cfg *config.Config, tpu DeleteTPUCP, gce DeleteGCECP) subcommands.Command

DeleteCommandAlias creates an alias for the delete command with a shorter name.

func ListCommand

ListCommand creates the list command.

func ListCommandAlias

func ListCommandAlias(cfg *config.Config, tpu ListTPUInstancesCP, gce ListGCEInstancesCP) subcommands.Command

ListCommandAlias creates an alias to the list command with a shorter name.

func PauseCommand

func PauseCommand(cfg *config.Config, tpu PauseTPUCP, gce PauseGCECP) subcommands.Command

PauseCommand creates the pause command.

func PauseCommandAlias

func PauseCommandAlias(cfg *config.Config, tpu PauseTPUCP, gce PauseGCECP) subcommands.Command

PauseCommandAlias creates an alias to the pause command with a shorter name.

func QuotaCommand

func QuotaCommand(config *config.Config) subcommands.Command

QuotaCommand creates the quota command.

func RestartCommand

func RestartCommand(cfg *config.Config, tpu RestartTPUCP) subcommands.Command

RestartCommand creates the restart subcommand.

func StatusCommand

func StatusCommand(cfg *config.Config, tpu StatusTPUCP, gce StatusGCECP) subcommands.Command

StatusCommand creates the status command.

func StatusCommandAlias

func StatusCommandAlias(cfg *config.Config, tpu StatusTPUCP, gce StatusGCECP) subcommands.Command

StatusCommandAlias creates an alias for the status command with a shorter name.

func TFVersionsCommand

func TFVersionsCommand(cfg *config.Config, versions TFVersionsCP) subcommands.Command

TFVersionsCommand creates the 'tf-versions' command.

func TPULocationsCommand

func TPULocationsCommand(cfg *config.Config, tpus TPULocationsCP) subcommands.Command

TPULocationsCommand creates the tpu-locations command.

func TPUSizeCommand

func TPUSizeCommand(cfg *config.Config, tpus TPUSizeCP) subcommands.Command

TPUSizeCommand constructs the tpu-sizes subcommand.

func UpCommand

UpCommand creates the up command.

func VersionCommand

func VersionCommand(version string) subcommands.Command

VersionCommand creates the version command.

Types

type AuthResourceManagementCP

type AuthResourceManagementCP interface {
	GetProject() (*cloudresourcemanager.Project, error)

	// GetProjectPolicy retrieves the current project's IAM policy.
	GetProjectPolicy() (*cloudresourcemanager.Policy, error)

	// SetProjectPolicy sets the policy.
	SetProjectPolicy(policy *cloudresourcemanager.Policy) error

	// GetBucketACL retrieves a Cloud Storage bucket's ACL list.
	GetBucketACL(ctx context.Context, bucket string) ([]storage.ACLRule, error)

	// SetBucketACL adds the entity + role pair to the ACL list for the provided bucket.
	SetBucketACL(ctx context.Context, bucket string, entity storage.ACLEntity, role storage.ACLRole) error
}

AuthResourceManagementCP abstracts the key operations the auth subcommand family must perform.

type ConfigGcloudCLI

type ConfigGcloudCLI interface {
	// IsGcloudInstalled returns true if gcloud is installed.
	IsGcloudInstalled() bool
	// PrintInstallInstructions prints install instructions to the console.
	PrintInstallInstructions()
}

ConfigGcloudCLI encapsulates interaction with the gcloud CLI toolchain.

type DeleteGCECP

type DeleteGCECP interface {
	// Instance retrieves the instance from the control plane (if available).
	Instance() (*ctrl.GCEInstance, error)
	// DeleteInstance requests the deletion of the instance.
	DeleteInstance() (ctrl.LongRunningOperation, error)
}

DeleteGCECP abstracts the control plane interfaces required for the delete command.

type DeleteTPUCP

type DeleteTPUCP interface {
	// Instance retrieves the instance from the control plane (if available).
	Instance() (*ctrl.TPUInstance, error)
	// DeleteInstance requests the deletion of the instance.
	DeleteInstance() (ctrl.LongRunningOperation, error)
}

DeleteTPUCP abstratcs the control plane interfaces required for the delete command.

type ListGCEInstancesCP

type ListGCEInstancesCP interface {
	// ListInstances lists the available Compute Engine instances.
	ListInstances() ([]*ctrl.GCEInstance, error)
}

ListGCEInstancesCP lists the available Compute Engine instances.

type ListTPUInstancesCP

type ListTPUInstancesCP interface {
	// ListInstances lists the available TPU instances.
	ListInstances() ([]*ctrl.TPUInstance, error)
}

ListTPUInstancesCP lists the available TPU instances.

type PauseGCECP

type PauseGCECP interface {
	// Instance retrieves the instance from the control plane (if available).
	Instance() (*ctrl.GCEInstance, error)
	// StopInstance requests the halting of the instance.
	StopInstance() (ctrl.LongRunningOperation, error)
}

PauseGCECP abstracts the control plane interfaces required for the pause command.

type PauseTPUCP

type PauseTPUCP interface {
	// Instance retrieves the instance from the control plane (if available).
	Instance() (*ctrl.TPUInstance, error)
	// DeleteInstance requests the deletion of the instance.
	DeleteInstance() (ctrl.LongRunningOperation, error)
}

PauseTPUCP abstracts the control plane interfaces required for the pause command.

type RestartTPUCP

type RestartTPUCP interface {
	// Instance retrieves the instance from the control plane (if available).
	Instance() (*ctrl.TPUInstance, error)
	// CreateInstance requests the creation of the instance.
	//
	// CreateInstance is implemented by TPUCP.CreateInstance and is expected to match.
	CreateInstance(ctx context.Context, version string, preemptible, reserved bool, hardwareType, network string) (ctrl.LongRunningOperation, error)
	// DeleteInstance requests the deletion of the instance.
	DeleteInstance() (ctrl.LongRunningOperation, error)
}

RestartTPUCP abstracts the control plane interfaces required for the restart command.

type StatusGCECP

type StatusGCECP interface {
	// OptionallyRetrieveInstance retrieves the instance, but can optionally not enable the TPU API.
	OptionallyRetrieveInstance(bool) (*ctrl.GCEInstance, bool, error)
}

StatusGCECP encapsulates the control plane interfaces required to execute the Status command.

type StatusTPUCP

type StatusTPUCP interface {
	// OptionallyRetrieveInstance retrieves the instance, but can optionally not enable the TPU API.
	OptionallyRetrieveInstance(bool) (*ctrl.TPUInstance, bool, error)
}

StatusTPUCP encapsulates the control plane interfaces required to execute the Status command.

type TFVersionsCP

type TFVersionsCP interface {
	// ListVersions returns the available TPU TensorFlow versions.
	ListVersions() ([]*tpu.TensorFlowVersion, error)
}

TFVersionsCP lists the available TensorFlow versions

type TPULocationsCP

type TPULocationsCP interface {
	// ListLocations lists available locations.
	ListLocations() ([]*tpu.Location, error)
}

TPULocationsCP lists available TPU locations.

type TPUSizeCP

type TPUSizeCP interface {
	// ListSizes lists available TPU sizes.
	ListSizes() ([]*tpu.AcceleratorType, error)
}

TPUSizeCP represents the interface required of the TPU control plane to run this subcommand.

type UpGCECP

type UpGCECP interface {
	// Instance retrieves the instance from the control plane (if available).
	Instance() (*ctrl.GCEInstance, error)
	// OptionallyRetrieveInstance retrieves the instance, but can optionally not enable the TPU API.
	OptionallyRetrieveInstance(bool) (*ctrl.GCEInstance, bool, error)
	// CreateInstance requests the creation of the instance.
	CreateInstance(*ctrl.GCECreateRequest) (ctrl.LongRunningOperation, error)
	// StartInstance requests the starting of the instance.
	StartInstance() (ctrl.LongRunningOperation, error)
}

UpGCECP abstracts the control plane interface requred for the up command.

type UpGcloudCLI

type UpGcloudCLI interface {
	// IsGcloudInstalled determines if the gcloud command line tool is installed and available on the path.
	IsGcloudInstalled() bool
	// SSHToInstance takes over the process and turns it into an ssh connection to the Compute Engine instance of the flock.
	SSHToInstance(forwardPorts, forwardAgent bool, tpuInstance *ctrl.TPUInstance) error
	// PrintInstallInstructions prints instructions to the console for how to install gcloud.
	PrintInstallInstructions()
}

UpGcloudCLI abstracts the interaction with the gcloud command line tools for the up command.

type UpResourceManagementCP

type UpResourceManagementCP interface {
	// AddTPUUserAgent authorizes the TPU user agent, if required.
	AddTPUUserAgent(tpuUserAgent string) error

	// IsProjectInGoogleOrg determines if the project is part of the Google organziation.
	//
	// This is used to provide more helpful error messages
	IsProjectInGoogleOrg() (bool, error)
}

UpResourceManagementCP abstracts the control plane interface required for the up command.

type UpTPUCP

type UpTPUCP interface {
	// Instance retrieves the instance from the control plane (if available).
	Instance() (*ctrl.TPUInstance, error)
	// OptionallyRetrieveInstance retrieves the instance, but can optionally not enable the TPU API.
	OptionallyRetrieveInstance(bool) (*ctrl.TPUInstance, bool, error)
	// CreateInstance requests the creation of the instance.
	CreateInstance(ctx context.Context, version string, preemptible, reserved bool, hardwareType, network string) (ctrl.LongRunningOperation, error)
	// ListVersions retrieves the list of available TensorFlow versions.
	ListVersions() ([]*tpu.TensorFlowVersion, error)
}

UpTPUCP abstracts the control plane interface required for the up command.

Jump to

Keyboard shortcuts

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