job

package
v0.0.0-...-63319d1 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MPL-2.0, Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GenericJdbcConnector   = "generic-jdbc-connector"
	ObsConnector           = "obs-connector"
	ThirdpartyObsConnector = "thirdparty-obs-connector"
	HdfsConnector          = "hdfs-connector"
	HbaseConnector         = "hbase-connector"
	HiveConnector          = "hive-connector"
	SftpConnector          = "sftp-connector"
	FtpConnector           = "ftp-connector"
	MongodbConnector       = "mongodb-connector"
	KafkaConnector         = "kafka-connector"
	DisConnector           = "dis-connector"
	ElasticsearchConnector = "elasticsearch-connector"
	DliConnector           = "dli-connector"
	OpentsdbConnector      = "opentsdb-connector"
	DmsKafkaConnector      = "dms-kafka-connector"

	StatusBooting         = "BOOTING"
	StatusFailureOnSubmit = "FAILURE_ON_SUBMIT"
	StatusRunning         = "RUNNING"
	StatusSucceeded       = "SUCCEEDED"
	StatusFailed          = "FAILED"
	StatusUnknown         = "UNKNOWN"
	StatusNeverExecuted   = "NEVER_EXECUTED"
)

Variables

View Source
var RequestOpts = golangsdk.RequestOpts{
	MoreHeaders: map[string]string{"Content-Type": "application/json", "X-Language": "en-us"},
}

Functions

func ListJobSubmissionsURL

func ListJobSubmissionsURL(c *golangsdk.ServiceClient, clusterId string) string

GET /v1.1/{project_id}/clusters/{cluster_id}/cdm/submissions

func Stop

func Stop(c *golangsdk.ServiceClient, clusterId string, jobName string) *golangsdk.ErrResult

Types

type Configs

type Configs struct {
	Inputs []Input `json:"inputs" required:"true"`
	Name   string  `json:"name" required:"true"`
}

type Counter

type Counter struct {
	BytesWritten       int `json:"BYTES_WRITTEN"`
	TotalFiles         int `json:"TOTAL_FILES"`
	RowsRead           int `json:"ROWS_READ"`
	BytesRead          int `json:"BYTES_READ"`
	RowsWritten        int `json:"ROWS_WRITTEN"`
	FilesWritten       int `json:"FILES_WRITTEN"`
	FilesRead          int `json:"FILES_READ"`
	TotalSize          int `json:"TOTAL_SIZE"`
	FilesSkipped       int `json:"FILES_SKIPPED"`
	RowsWrittenSkipped int `json:"ROWS_WRITTEN_SKIPPED"`
}

type Counters

type Counters struct {
	SqoopCounters Counter `json:"org.apache.sqoop.submission.counter.SqoopCounters"`
}

type CreateResponse

type CreateResponse struct {
	Name             string             `json:"name"`
	ValidationResult []ValidationDetail `json:"validation-result"`
}

func Create

func Create(c *golangsdk.ServiceClient, clusterId string, opts JobCreateOpts) (*CreateResponse, error)

type ErrorResponse

type ErrorResponse struct {
	// Error code
	ErrCode string `json:"errCode"`
	// Error message
	ErrMessage string `json:"externalMessage"`
}

func Delete

func Delete(c *golangsdk.ServiceClient, clusterId string, name string) (*ErrorResponse, error)

type GetJobsOpts

type GetJobsOpts struct {
	// When job_name is all, this parameter is used for fuzzy job filtering.
	Filter string `q:"filter"`
	// Page number  Minimum: 1
	PageNo int `q:"page_no"`
	// Number of jobs on each page. The value ranges from 10 to 100.
	PageSize int `q:"page_size"`
	// Job type. The options are as follows:
	// jobType=NORMAL_JOB: table/file migration job
	// jobType=BATCH_JOB: entire DB migration job
	// jobType=SCENARIO_JOB: scenario migration job
	// If this parameter is not specified, only table/file migration jobs are queried by default.
	JobType string `q:"jobType"`
}

type Input

type Input struct {
	Name  string `json:"name,omitempty"`
	Value string `json:"value,omitempty"`
	Type  string `json:"type,omitempty"`
}

type Job

type Job struct {
	// Job type. The options are as follows:
	// NORMAL_JOB: table/file migration
	// BATCH_JOB: entire DB migration
	// SCENARIO_JOB: scenario migration
	JobType string `json:"job_type,omitempty"`
	// Job name, which contains 1 to 240 characters.
	Name string `json:"name,omitempty"`

	// Source link name
	FromLinkName string `json:"from-link-name,omitempty"`
	// Source link type
	FromConnectorName string `json:"from-connector-name,omitempty"`
	// Source link parameter configuration
	FromConfigValues JobConfigs `json:"from-config-values,omitempty"`

	// Destination link name
	ToLinkName string `json:"to-link-name,omitempty"`
	// Destination link type
	ToConnectorName string `json:"to-connector-name,omitempty"`
	// Destination link parameter configuration
	ToConfigValues JobConfigs `json:"to-config-values,omitempty"`

	// Job parameter configuration
	DriverConfigValues JobConfigs `json:"driver-config-values,omitempty"`

	CreationUser string `json:"creation-user,omitempty"`
	CreationDate *int   `json:"creation-date,omitempty"`
	UpdateDate   *int   `json:"update-date,omitempty"`
	UpdateUser   string `json:"update-user,omitempty"`
	// Status of a job. The options are as follows:
	// BOOTING: starting
	// RUNNING: running
	// SUCCEEDED: successful
	// FAILED: failed
	// NEW: not executed
	Status string `json:"status,omitempty"`
}

type JobConfigs

type JobConfigs struct {
	Configs []Configs `json:"configs,omitempty"`
}

type JobCreateOpts

type JobCreateOpts struct {
	Jobs []Job `json:"jobs" required:"true"`
}

type JobSubmission

type JobSubmission struct {
	DeleteRows   int    `json:"delete_rows"`
	UpdateRows   int    `json:"update_rows"`
	WriteRows    int    `json:"write_rows"`
	SubmissionId int    `json:"submission-id"`
	JobName      string `json:"job-name"`
	CreationUser string `json:"creation-user"`
	CreationDate int    `json:"creation-date"`
	// Job progress. If a job fails, the value is -1. Otherwise, the value ranges from 0 to 100.
	Progress float32 `json:"progress"`
	// Job status. The options are as follows:
	// BOOTING: The job is starting.
	// FAILURE_ON_SUBMIT: The job fails to be submitted.
	// RUNNING: The job is running.
	// SUCCEEDED: The job is executed successfully.
	// FAILED: The job failed.
	// UNKNOWN: The job status is unknown.
	// NEVER_EXECUTED: The job has not been executed.
	Status             string `json:"status"`
	IsStopingIncrement string `json:"isStopingIncrement"`
	IsExecuteAuto      bool   `json:"is-execute-auto"`
	// Whether the job involves incremental data migration
	IsIncrementing bool `json:"isIncrementing"`

	LastUpdateDate int    `json:"last-update-date"`
	LastUdpateUser string `json:"last-udpate-user"`
	// Whether to delete the job after it is executed
	IsDeleteJob bool `json:"isDeleteJob"`
}

type JobsDetail

type JobsDetail struct {
	Total    int   `json:"total"`
	Jobs     []Job `json:"jobs"`
	PageNo   int   `json:"page_no"`
	PageSize int   `json:"page_size"`
	// Whether to return compact information. If this parameter is set to true, compact information will be returned,
	// which means only parameter names and values will be returned.
	// Attributes such as size, type, and id will not be returned.
	Simple bool `json:"simple"`
}

func Get

func Get(c *golangsdk.ServiceClient, clusterId string, jobName string, opts GetJobsOpts) (*JobsDetail, error)

type ListJobSubmissionsOpts

type ListJobSubmissionsOpts struct {
	JobName string `q:"jname"`
}

type ListSubmissionsRst

type ListSubmissionsRst struct {
	Submissions []StatusSubmission `json:"submissions"`
	Total       int                `json:"total"`
	PageNo      int                `json:"page_no"`
	PageSize    int                `json:"page_size"`
}

func ListJobSubmissions

func ListJobSubmissions(c *golangsdk.ServiceClient, clusterId string, opts ListJobSubmissionsOpts) (*ListSubmissionsRst,
	error)

type StartJobResponse

type StartJobResponse struct {
	Submissions []JobSubmission `json:"submissions"`
}

func Start

func Start(c *golangsdk.ServiceClient, clusterId string, jobName string) (*StartJobResponse, error)

type StatusResponse

type StatusResponse struct {
	Submissions []StatusSubmission `json:"submissions"`
}

func GetJobStatus

func GetJobStatus(c *golangsdk.ServiceClient, clusterId string, jobName string) (*StatusResponse, error)

type StatusSubmission

type StatusSubmission struct {
	JobSubmission

	// Job running result statistics. This parameter is available only when status is SUCCEEDED.
	Counters     Counters `json:"counters"`
	ExternalId   string   `json:"external-id"`
	ExecuteDate  int      `json:"execute-date"`
	ErrorDetails string   `json:"error-details"`
	ErrorSummary string   `json:"error-summary"`
}

type UpdateResponse

type UpdateResponse struct {
	ValidationResult []validationResult `json:"validation-result"`
}

func Update

func Update(c *golangsdk.ServiceClient, clusterId string, name string, opts JobCreateOpts) (*UpdateResponse, error)

type ValidationDetail

type ValidationDetail struct {
	Message string `json:"message"`
	// ERROR,WARNING
	Status string `json:"status"`
}

Jump to

Keyboard shortcuts

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