flink

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client - Flink API client.

func NewClient

func NewClient(log logr.Logger, httpClient *http.Client) *Client

func NewDefaultClient

func NewDefaultClient(log logr.Logger) *Client

func (*Client) GetJobExceptions

func (c *Client) GetJobExceptions(apiBaseURL string, jobId string) (*JobExceptions, error)

func (*Client) GetJobsOverview

func (c *Client) GetJobsOverview(apiBaseURL string) (*JobsOverview, error)

func (*Client) GetSavepointStatus

func (c *Client) GetSavepointStatus(
	apiBaseURL string, jobID string, triggerID string) (*SavepointStatus, error)

GetSavepointStatus returns savepoint status.

Flink API response examples:

1) success:

{
   "status":{"id":"COMPLETED"},
   "operation":{
     "location":"file:/tmp/savepoint-ad4025-dd46c1bd1c80"
   }
}

2) failure:

{
   "status":{"id":"COMPLETED"},
   "operation":{
     "failure-cause":{
       "class": "java.util.concurrent.CompletionException",
       "stack-trace": "..."
     }
   }
}

func (*Client) StopJob

func (c *Client) StopJob(
	apiBaseURL string, jobID string) error

StopJob stops a job.

func (*Client) TakeSavepoint

func (c *Client) TakeSavepoint(apiBaseURL string, jobID string, dir string) (*SavepointStatus, error)

TakeSavepoint takes savepoint, blocks until it succeeds or fails.

func (*Client) TakeSavepointAsync

func (c *Client) TakeSavepointAsync(apiBaseURL string, jobID string, dir string) (string, error)

func (*Client) TriggerSavepoint

func (c *Client) TriggerSavepoint(apiBaseURL string, jobID string, dir string, cancel bool) (*SavepointTriggerID, error)

TriggerSavepoint triggers an async savepoint operation.

type Job

type Job struct {
	Id        string `json:"jid"`
	State     string `json:"state"`
	Name      string `json:"name"`
	StartTime int64  `json:"start-time"`
	EndTime   int64  `json:"end-time"`
	Duration  int64  `json:"duration"`
}

Job defines Flink job status.

type JobByStartTime

type JobByStartTime []Job

func (JobByStartTime) Len

func (jst JobByStartTime) Len() int

func (JobByStartTime) Less

func (jst JobByStartTime) Less(i, j int) bool

func (JobByStartTime) Swap

func (jst JobByStartTime) Swap(i, j int)

type JobException

type JobException struct {
	Exception string `json:"exception"`
	Location  string `json:"location"`
}

type JobExceptions

type JobExceptions struct {
	Exceptions []JobException `json:"all-exceptions"`
}

type JobsOverview

type JobsOverview struct {
	Jobs []Job
}

JobsOverview defines Flink job overview list.

type SavepointFailureCause

type SavepointFailureCause struct {
	ExceptionClass string `json:"class"`
	StackTrace     string `json:"stack-trace"`
}

SavepointFailureCause defines the cause of savepoint failure.

type SavepointStateID

type SavepointStateID struct {
	ID string `json:"id"`
}

SavepointStateID - enum("IN_PROGRESS", "COMPLETED").

type SavepointStatus

type SavepointStatus struct {
	// Flink job ID.
	JobID string
	// Savepoint operation trigger ID.
	TriggerID string
	// Completed or not.
	Completed bool
	// Savepoint location URI, non-empty when savepoint succeeded.
	Location string
	// Cause of the failure, non-empyt when savepoint failed
	FailureCause SavepointFailureCause
}

SavepointStatus defines savepoint status of a job.

func (*SavepointStatus) IsFailed

func (s *SavepointStatus) IsFailed() bool

func (*SavepointStatus) IsSuccessful

func (s *SavepointStatus) IsSuccessful() bool

type SavepointTriggerID

type SavepointTriggerID struct {
	RequestID string `json:"request-id"`
}

SavepointTriggerID defines trigger ID of an async savepoint operation.

Jump to

Keyboard shortcuts

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