flink

package
v0.0.0-...-7d9b34d Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RetryPolicy

func RetryPolicy(ctx context.Context, resp *http.Response, err error) (bool, error)

Do not retry when status code is 500. (indicating the job is not stoppable)

Types

type CreateSavepointResponse

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

CreateSavepointResponse represents the response body used by the create savepoint API

type FlinkRestAPI

type FlinkRestAPI interface {
	Terminate(jobID string, mode string) error
	CreateSavepoint(jobID string, savepointPath string) (CreateSavepointResponse, error)
	MonitorSavepointCreation(jobID string, requestID string) (MonitorSavepointCreationResponse, error)
	RetrieveJobs() ([]Job, error)
	RunJar(jarID string, entryClass string, jarArgs []string, parallelism int, savepointPath string, allowNonRestoredState bool) error
	UploadJar(filename string) (UploadJarResponse, error)
}

FlinkRestAPI is an interface representing the ability to execute multiple HTTP requests against the Apache Flink API.

type FlinkRestClient

type FlinkRestClient struct {
	BaseURL           string
	BasicAuthUsername string
	BasicAuthPassword string
	Client            *retryablehttp.Client
}

A FlinkRestClient is a client to interface with the Apache Flink REST API

func (FlinkRestClient) CreateSavepoint

func (c FlinkRestClient) CreateSavepoint(jobID string, savepointPath string) (CreateSavepointResponse, error)

CreateSavepoint creates a savepoint for a job specified by job ID

func (FlinkRestClient) MonitorSavepointCreation

func (c FlinkRestClient) MonitorSavepointCreation(jobID string, requestID string) (MonitorSavepointCreationResponse, error)

MonitorSavepointCreation allows for monitoring the status of a savepoint creation identified by the job ID and request ID

func (FlinkRestClient) RetrieveJobs

func (c FlinkRestClient) RetrieveJobs() ([]Job, error)

RetrieveJobs returns all the jobs on the Flink cluster

func (FlinkRestClient) RunJar

func (c FlinkRestClient) RunJar(jarID string, entryClass string, jarArgs []string, parallelism int, savepointPath string, allowNonRestoredState bool) error

RunJar executes a specific JAR file with the supplied parameters on the Flink cluster

func (FlinkRestClient) Terminate

func (c FlinkRestClient) Terminate(jobID string, mode string) error

Terminate terminates a running job specified by job ID

func (FlinkRestClient) UploadJar

func (c FlinkRestClient) UploadJar(filename string) (UploadJarResponse, error)

UploadJar allows for uploading a JAR file to the Flink cluster

type Job

type Job struct {
	ID     string `json:"jid"`
	Name   string `json:"name"`
	Status string `json:"state"`
}

A Job is a representation for a Flink Job

type MonitorSavepointCreationResponse

type MonitorSavepointCreationResponse struct {
	Status SavepointCreationStatus `json:"status"`
}

MonitorSavepointCreationResponse represents the response body used by the savepoint monitoring API

type SavepointCreationStatus

type SavepointCreationStatus struct {
	Id string `json:"id"`
}

SavepointCreationStatus represents the savepoint creation status used by the API

type TerminateJobErrorResponse

type TerminateJobErrorResponse struct {
	ErrInfo string `json:"error"`
}

type UploadJarResponse

type UploadJarResponse struct {
	Filename string `json:"filename"`
	Status   string `json:"status"`
}

UploadJarResponse represents the response body used by the upload JAR API

Jump to

Keyboard shortcuts

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