flinkclient

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FlinkClient

type FlinkClient struct {
	Log        logr.Logger
	HTTPClient HTTPClient
}

FlinkClient - Flink API client.

func (*FlinkClient) GetJobStatusList

func (c *FlinkClient) GetJobStatusList(
	apiBaseURL string, jobStatusList *JobStatusList) error

GetJobStatusList gets Flink job status list.

func (*FlinkClient) GetSavepointStatus

func (c *FlinkClient) 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 (*FlinkClient) StopJob

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

StopJob stops a job.

func (*FlinkClient) TakeSavepoint

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

TakeSavepoint takes savepoint, blocks until it suceeds or fails.

func (*FlinkClient) TriggerSavepoint

func (c *FlinkClient) TriggerSavepoint(
	apiBaseURL string, jobID string, dir string) (SavepointTriggerID, error)

TriggerSavepoint triggers an async savepoint operation.

type HTTPClient

type HTTPClient struct {
	Log logr.Logger
}

HTTPClient - HTTP client.

func (*HTTPClient) Get

func (c *HTTPClient) Get(url string, outStructPtr interface{}) error

Get - HTTP GET.

func (*HTTPClient) Patch

func (c *HTTPClient) Patch(
	url string, body []byte, outStructPtr interface{}) error

Patch - HTTP PATCH.

func (*HTTPClient) Post

func (c *HTTPClient) Post(
	url string, body []byte, outStructPtr interface{}) error

Post - HTTP POST.

type JobStatus

type JobStatus struct {
	ID     string
	Status string
}

JobStatus defines Flink job status.

type JobStatusList

type JobStatusList struct {
	Jobs []JobStatus
}

JobStatusList defines Flink job status 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.

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