cli

package
v0.0.0-...-ac6a2c4 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2019 License: Apache-2.0 Imports: 55 Imported by: 0

Documentation

Index

Constants

View Source
const ResourcePoolPathDelim = "/"

ResourcePoolPathDelim is the resource pool path delimiter

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {

	// Debug is whether debug output is enabled
	Debug bool
	// contains filtered or unexported fields
}

Client is a JSON Client with associated dispatcher and context

func New

func New(
	discovery leader.Discovery,
	timeout time.Duration,
	authConfig *middleware.BasicAuthConfig,
	debug bool) (*Client, error)

New returns a new RPC client given a framework URL and timeout and error

func (*Client) AskConfirm

func (c *Client) AskConfirm(message string) bool

AskConfirm asks for a confirmation for the message.

func (*Client) CancelWatch

func (c *Client) CancelWatch(watchID string) error

CancelWatch is the action for cancelling an existing watch stream.

func (*Client) Cleanup

func (c *Client) Cleanup()

Cleanup ensures the client's YARPC dispatcher is stopped

func (*Client) DisableKillTasksAction

func (c *Client) DisableKillTasksAction() error

DisableKillTasksAction disable the kill task request to mesos master

func (*Client) EventStreamAction

func (c *Client) EventStreamAction() error

EventStreamAction prints all task status update events present in the event stream.

func (*Client) ExtractHostnames

func (c *Client) ExtractHostnames(hosts string, hostSeparator string) ([]string, error)

ExtractHostnames extracts a list of hosts from a comma-separated list

func (*Client) HostCacheDump

func (c *Client) HostCacheDump() error

HostCacheDump dumps the contents of the host cache.

func (*Client) HostMaintenanceCompleteAction

func (c *Client) HostMaintenanceCompleteAction(hostname string) error

HostMaintenanceCompleteAction is the action for completing host maintenance. Complete maintenance brings UP a host which is in maintenance by posting to /machine/up endpoint of Mesos Master i.e. the machine transitions from DOWN to UP state (Please check Mesos Maintenance Primitives for more info)

func (*Client) HostMaintenanceStartAction

func (c *Client) HostMaintenanceStartAction(hostname string) error

HostMaintenanceStartAction is the action for starting host maintenance. StartMaintenance puts the host into DRAINING state by posting a maintenance schedule to Mesos Master. Inverse offers are sent out and all future offers from the host are tagged with unavailability (Please check Mesos Maintenance Primitives for more info). The host is first drained of tasks before being put into maintenance by posting to /machine/down endpoint of Mesos Master. The host transitions from UP to DRAINING and finally to DOWN.

func (*Client) HostPoolChangePool

func (c *Client) HostPoolChangePool(host, source, dest string) error

HostPoolChangePool changes the pool for a host.

func (*Client) HostPoolCreate

func (c *Client) HostPoolCreate(name string) error

HostPoolCreate creates a host pool.

func (*Client) HostPoolDelete

func (c *Client) HostPoolDelete(name string) error

HostPoolDelete deletes a host pool.

func (*Client) HostPoolList

func (c *Client) HostPoolList() error

HostPoolList lists all the host pools.

func (*Client) HostPoolListHosts

func (c *Client) HostPoolListHosts(name string) error

HostPoolListHosts lists all hosts in a host pool.

func (*Client) HostQueryAction

func (c *Client) HostQueryAction(states string) error

HostQueryAction is the action for querying hosts by states. This can be to used to monitor the state of the host(s) Eg. When a list of hosts are put into maintenance (`host maintenance start`). A host, at any given time, will be in one of the following states

1.HostState_HOST_STATE_UP - The host is up and running
2.HostState_HOST_STATE_DRAINING - The tasks running on the host are being rescheduled and
								  there will be no further placement of tasks on the host
3.HostState_HOST_STATE_DRAINED - There are no tasks running on this host and it is ready to be 'DOWN'ed
4.HostState_HOST_STATE_DOWN - The host is in maintenance.

func (*Client) HostsGetAction

func (c *Client) HostsGetAction(
	cpu float64,
	gpu float64,
	mem float64,
	disk float64,
	cmpLess bool,
	hosts string,
	revocable bool,
) error

HostsGetAction prints all the hosts based on resource requirement passed in.

func (*Client) JobCreateAction

func (c *Client) JobCreateAction(
	jobID, respoolPath, cfg, secretPath string, secret []byte,
) error

JobCreateAction is the action for creating a job

func (*Client) JobDeleteAction

func (c *Client) JobDeleteAction(jobID string) error

JobDeleteAction is the action for deleting a job

func (*Client) JobGetAction

func (c *Client) JobGetAction(jobID string) error

JobGetAction is the action for getting a job

func (*Client) JobGetActiveJobsAction

func (c *Client) JobGetActiveJobsAction() error

JobGetActiveJobsAction is the action for getting active jobs list

func (*Client) JobGetCacheAction

func (c *Client) JobGetCacheAction(jobID string) error

JobGetCacheAction is the action for getting a job cache

func (*Client) JobMgrGetInstanceAvailabilityInfoForJob

func (c *Client) JobMgrGetInstanceAvailabilityInfoForJob(
	jobID string,
	instances string,
) error

func (*Client) JobMgrGetThrottledPods

func (c *Client) JobMgrGetThrottledPods() error

func (*Client) JobMgrQueryJobCache

func (c *Client) JobMgrQueryJobCache(
	labels string,
	name string,
) error

func (*Client) JobQueryAction

func (c *Client) JobQueryAction(
	labels string,
	respoolPath string,
	keywords string,
	states string,
	owner string,
	name string,
	days uint32,
	limit uint32,
	maxLimit uint32,
	offset uint32,
	sortBy string,
	sortOrder string) error

JobQueryAction is the action for getting job ids by labels, respool path, keywords, state(s), owner and jobname

func (*Client) JobRefreshAction

func (c *Client) JobRefreshAction(jobID string) error

JobRefreshAction calls the refresh API for a job

func (*Client) JobRestartAction

func (c *Client) JobRestartAction(
	jobID string,
	resourceVersion uint64,
	instanceRanges []*task.InstanceRange,
	batchSize uint32,
) error

JobRestartAction is the action for restarting a job

func (*Client) JobStartAction

func (c *Client) JobStartAction(
	jobID string,
	resourceVersion uint64,
	instanceRanges []*task.InstanceRange,
	batchSize uint32,
) error

JobStartAction is the action for starting a job

func (*Client) JobStatusAction

func (c *Client) JobStatusAction(jobID string) error

JobStatusAction is the action for getting status of a job

func (*Client) JobStopAction

func (c *Client) JobStopAction(
	jobID string,
	showProgress bool,
	owner string,
	labels string,
	isForceStop bool,
	jobStopLimit uint32,
	jobStopMaxLimit uint32,
) error

JobStopAction is the action of stopping job(s) by jobID, owner and labels

func (*Client) JobStopV1BetaAction

func (c *Client) JobStopV1BetaAction(
	jobID string,
	resourceVersion uint64,
	instanceRanges []*task.InstanceRange,
	batchSize uint32,
) error

JobStopV1BetaAction is the action for stopping a job using new job API

func (*Client) JobUpdateAction

func (c *Client) JobUpdateAction(
	jobID, cfg, secretPath string, secret []byte) error

JobUpdateAction is the action of updating a job

func (*Client) LockComponents

func (c *Client) LockComponents(components []string) error

func (*Client) LookupResourcePoolID

func (c *Client) LookupResourcePoolID(resourcePoolPath string) (*peloton.ResourcePoolID, error)

LookupResourcePoolID returns the resource pool ID for a given path

func (*Client) OffersGetAction

func (c *Client) OffersGetAction() error

OffersGetAction prints all the outstanding offers present in Host Manager offer pool.

func (*Client) PodDeleteEvents

func (c *Client) PodDeleteEvents(podName string, podID string) error

PodDeleteEvents is the action for deleting events of the pod

func (*Client) PodGetAction

func (c *Client) PodGetAction(
	podName string,
	statusOnly bool,
	limit uint32,
) error

PodGetAction is the action for getting the info of the pod

func (*Client) PodGetCacheAction

func (c *Client) PodGetCacheAction(podName string) error

PodGetCacheAction is the action to get pod status from cache

func (*Client) PodGetEventsAction

func (c *Client) PodGetEventsAction(
	jobID string,
	instanceID uint32,
	runID string,
	limit uint64) error

PodGetEventsAction returns pod events in reverse chronological order.

func (*Client) PodGetEventsV1AlphaAction

func (c *Client) PodGetEventsV1AlphaAction(podName string, podID string) error

PodGetEventsV1AlphaAction is the action to get the events of a given pod

func (*Client) PodLogsGetAction

func (c *Client) PodLogsGetAction(filename string, podName string, podID string) error

PodLogsGetAction is the action to get logs files for given pod

func (*Client) PodRefreshAction

func (c *Client) PodRefreshAction(podName string) error

PodRefreshAction is the action to refresh the pod

func (*Client) PodRestartAction

func (c *Client) PodRestartAction(podName string) error

PodRestartAction is the action for restarting the pod

func (*Client) PodStartAction

func (c *Client) PodStartAction(podName string) error

PodStartAction is the action for starting the pod

func (*Client) PodStopAction

func (c *Client) PodStopAction(podName string) error

PodStopAction is the action for stopping the pod

func (*Client) ResMgrGetActiveTasks

func (c *Client) ResMgrGetActiveTasks(jobID string, respoolID string, states string) error

ResMgrGetActiveTasks fetches the active tasks from resource manager.

func (*Client) ResMgrGetOrphanTasks

func (c *Client) ResMgrGetOrphanTasks(respoolID string) error

ResMgrGetOrphanTasks fetches the orphan tasks from resource manager.

func (*Client) ResMgrGetPendingTasks

func (c *Client) ResMgrGetPendingTasks(respoolID string, limit uint32) error

ResMgrGetPendingTasks fetches the pending tasks from resource manager.

func (*Client) ResPoolCreateAction

func (c *Client) ResPoolCreateAction(respoolPath string, cfgFile string) error

ResPoolCreateAction is the action for creating a resource pool

func (*Client) ResPoolDeleteAction

func (c *Client) ResPoolDeleteAction(respoolPath string) error

ResPoolDeleteAction is the action for deleting a resource pool

func (*Client) ResPoolDumpAction

func (c *Client) ResPoolDumpAction(resPoolDumpFormat string) error

ResPoolDumpAction dumps the resource pool tree

func (*Client) ResPoolUpdateAction

func (c *Client) ResPoolUpdateAction(
	respoolPath string,
	cfgFile string,
	force bool) error

ResPoolUpdateAction is the action for updating an existing resource pool

func (*Client) StatelessCreateAction

func (c *Client) StatelessCreateAction(
	jobID string,
	respoolPath string,
	batchSize uint32,
	cfg string,
	secretPath string,
	secret []byte,
	opaque string,
	startPaused bool,
	maxInstanceRetries uint32,
	maxTolerableInstanceFailures uint32,
) error

StatelessCreateAction is the action for creating a stateless job

func (*Client) StatelessDeleteAction

func (c *Client) StatelessDeleteAction(
	jobID string,
	version string,
	forceDelete bool,
) error

StatelessDeleteAction is the action for deleting a stateless job

func (*Client) StatelessGetAction

func (c *Client) StatelessGetAction(
	jobID string,
	version string,
	summaryOnly bool,
) error

StatelessGetAction is the action for getting status and spec (or only summary) of a stateless job

func (*Client) StatelessGetCacheAction

func (c *Client) StatelessGetCacheAction(jobID string) error

StatelessGetCacheAction get cache of stateless job

func (*Client) StatelessListJobsAction

func (c *Client) StatelessListJobsAction() error

StatelessListJobsAction prints summary of all jobs using the ListJobs API

func (*Client) StatelessListPodsAction

func (c *Client) StatelessListPodsAction(
	jobID string,
	instanceRange *task.InstanceRange,
) error

StatelessListPodsAction is the action to list pods in a job

func (*Client) StatelessListUpdatesAction

func (c *Client) StatelessListUpdatesAction(
	jobID string,
	updatesLimit uint32,
) error

StatelessListUpdatesAction lists updates of a job

func (*Client) StatelessQueryAction

func (c *Client) StatelessQueryAction(
	labels string,
	respoolPath string,
	keywords string,
	states string,
	owner string,
	name string,
	days uint32,
	limit uint32,
	maxLimit uint32,
	offset uint32,
	sortBy string,
	sortOrder string) error

StatelessQueryAction queries a job given the spec

func (*Client) StatelessQueryPodsAction

func (c *Client) StatelessQueryPodsAction(
	jobID string,
	states string,
	names string,
	hosts string,
	limit uint32,
	offset uint32,
	sortBy string,
	sortOrder string,
) error

StatelessQueryPodsAction is the action for querying pods of a job

func (*Client) StatelessRefreshAction

func (c *Client) StatelessRefreshAction(jobID string) error

StatelessRefreshAction refreshes a job

func (*Client) StatelessReplaceJobAction

func (c *Client) StatelessReplaceJobAction(
	jobID string,
	spec string,
	batchSize uint32,
	respoolPath string,
	entityVersion string,
	override bool,
	maxInstanceRetries uint32,
	maxTolerableInstanceFailures uint32,
	rollbackOnFailure bool,
	startPaused bool,
	opaqueData string,
	inPlace bool,
	startPods bool,
) error

StatelessReplaceJobAction updates job by replace its config

func (*Client) StatelessReplaceJobDiffAction

func (c *Client) StatelessReplaceJobDiffAction(
	jobID string,
	spec string,
	entityVersion string,
	respoolPath string,
) error

StatelessReplaceJobDiffAction returns the set of instances which will be added, removed, updated and remain unchanged for a new job specification for a given job

func (*Client) StatelessRestartJobAction

func (c *Client) StatelessRestartJobAction(
	jobID string,
	batchSize uint32,
	entityVersion string,
	instanceRanges []*task.InstanceRange,
	opaqueData string,
	inPlace bool,
) error

StatelessRestartJobAction restarts a job

func (*Client) StatelessRollbackJobAction

func (c *Client) StatelessRollbackJobAction(
	jobID string,
	batchSize uint32,
	entityVersion string,
	maxInstanceRetries uint32,
	maxTolerableInstanceFailures uint32,
	startPaused bool,
	opaqueData string,
	inPlace bool,
	startPods bool,
) error

StatelessRollbackJobAction roll backs a job to an older entity version by getting the old configuration, and triggering a replace action with the old configiuration.

func (*Client) StatelessStartJobAction

func (c *Client) StatelessStartJobAction(
	jobID string,
	entityVersion string,
) error

StatelessStartJobAction is the action for starting a stateless job

func (*Client) StatelessStopJobAction

func (c *Client) StatelessStopJobAction(jobID string, entityVersion string) error

StatelessStopJobAction stops a job

func (*Client) StatelessWorkflowAbortAction

func (c *Client) StatelessWorkflowAbortAction(
	jobID string,
	entityVersion string,
	opaqueData string,
) error

StatelessWorkflowAbortAction aborts a workflow

func (*Client) StatelessWorkflowEventsAction

func (c *Client) StatelessWorkflowEventsAction(
	jobID string,
	instanceID uint32,
) error

StatelessWorkflowEventsAction gets most recent active or completed workflow events for a job

func (*Client) StatelessWorkflowPauseAction

func (c *Client) StatelessWorkflowPauseAction(
	jobID string,
	entityVersion string,
	opaqueData string,
) error

StatelessWorkflowPauseAction pauses a workflow

func (*Client) StatelessWorkflowResumeAction

func (c *Client) StatelessWorkflowResumeAction(
	jobID string,
	entityVersion string,
	opaqueData string,
) error

StatelessWorkflowResumeAction resumes a workflow

func (*Client) TaskGetAction

func (c *Client) TaskGetAction(jobID string, instanceID uint32) error

TaskGetAction is the action to get a task instance

func (*Client) TaskGetCacheAction

func (c *Client) TaskGetCacheAction(jobID string, instanceID uint32) error

TaskGetCacheAction is the acion to get a task cache

func (*Client) TaskGetEventsAction

func (c *Client) TaskGetEventsAction(jobID string, instanceID uint32) error

TaskGetEventsAction is the action to get a task instance

func (*Client) TaskListAction

func (c *Client) TaskListAction(jobID string, instanceRange *task.InstanceRange) error

TaskListAction is the action to list tasks

func (*Client) TaskLogsGetAction

func (c *Client) TaskLogsGetAction(fileName string, jobID string, instanceID uint32, taskID string) error

TaskLogsGetAction is the action to get logs files for given job instance.

func (*Client) TaskQueryAction

func (c *Client) TaskQueryAction(
	jobID string,
	states string,
	names string,
	hosts string,
	limit uint32,
	offset uint32,
	sortBy string,
	sortOrder string) error

TaskQueryAction is the action to query task

func (*Client) TaskRefreshAction

func (c *Client) TaskRefreshAction(jobID string, instanceRange *task.InstanceRange) error

TaskRefreshAction calls task refresh API

func (*Client) TaskRestartAction

func (c *Client) TaskRestartAction(jobID string, instanceRanges []*task.InstanceRange) error

TaskRestartAction is the action to restart a task

func (*Client) TaskStartAction

func (c *Client) TaskStartAction(jobID string, instanceRanges []*task.InstanceRange) error

TaskStartAction is the action to start a task

func (*Client) TaskStopAction

func (c *Client) TaskStopAction(jobID string,
	instanceRanges []*task.InstanceRange) error

TaskStopAction is the action to stop a task

func (*Client) UnlockComponents

func (c *Client) UnlockComponents(components []string) error

func (*Client) UpdateAbortAction

func (c *Client) UpdateAbortAction(updateID string, opaqueData string) error

UpdateAbortAction aborts a given update

func (*Client) UpdateCreateAction

func (c *Client) UpdateCreateAction(
	jobID string,
	cfg string,
	batchSize uint32,
	respoolPath string,
	configVersion uint64,
	override bool,
	maxInstanceAttempts uint32,
	maxFailureInstances uint32,
	updateRollbackOnFailure bool,
	updateStartInPausedState bool,
	opaqueData string,
	inPlace bool) error

UpdateCreateAction will create a new job update.

func (*Client) UpdateGetAction

func (c *Client) UpdateGetAction(updateID string) error

UpdateGetAction gets the summary/full update information

func (*Client) UpdateGetCacheAction

func (c *Client) UpdateGetCacheAction(updateID string) error

UpdateGetCacheAction fetches the information stored in the cache for the update

func (*Client) UpdateListAction

func (c *Client) UpdateListAction(jobID string) error

UpdateListAction lists all actions of a job update

func (*Client) UpdatePauseAction

func (c *Client) UpdatePauseAction(updateID string, opaqueData string) error

UpdatePauseAction pauses a given update

func (*Client) UpdateResumeAction

func (c *Client) UpdateResumeAction(updateID string, opaqueData string) error

UpdateResumeAction resumes a given update

func (*Client) VolumeDeleteAction

func (c *Client) VolumeDeleteAction(volumeID string) error

VolumeDeleteAction is the action to delete given volume.

func (*Client) VolumeListAction

func (c *Client) VolumeListAction(jobID string) error

VolumeListAction is the action to list volume for a job.

func (*Client) WatchEventStreamEvents

func (c *Client) WatchEventStreamEvents(topicToWatch string) error

WatchEventStreamEvents is the action for starting a watch stream for mesos task update events

func (*Client) WatchHostSummaryEvent

func (c *Client) WatchHostSummaryEvent(topicToWatch string) error

WatchHostSummaryEvent is the action for starting a watch stream for host summary events

func (*Client) WatchJob

func (c *Client) WatchJob(jobIDs []string, labels []string) error

WatchJob is the action for starting a watch stream for job, specified by job ids.

func (*Client) WatchPod

func (c *Client) WatchPod(jobID string, podNames []string, labels []string) error

WatchPod is the action for starting a watch stream for pod, specified by job id and pod names.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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