job

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderWorkspace   = "workspace"
	HeaderContentType = "Content-Type"

	ApplicationJson = "application/json"
)

Variables

This section is empty.

Functions

func BatchExportJob

func BatchExportJob(client *golangsdk.ServiceClient, reqOpts *BatchExportReq) (io.ReadCloser, error)

BatchExportJob is used to batch export jobs, including job dependency scripts and CDM job definitions. Send request POST /v1/{project_id}/jobs/batch-export

func Create

func Create(client *golangsdk.ServiceClient, opts Job) error

Create is used to create a job. A job consists of one or more nodes, such as Hive SQL and CDM Job nodes. DLF supports two types of jobs: batch jobs and real-time jobs. Send request POST /v1/{project_id}/jobs

func Delete

func Delete(client *golangsdk.ServiceClient, jobName string, reqOpts *DeleteReq) error

Delete is used to stop a job. Send request POST /v1/{project_id}/jobs/{job_name}

func ExportJob

func ExportJob(client *golangsdk.ServiceClient, jobName, workspace string) (io.ReadCloser, error)

ExportJob is used to export a job, including job definitions, job dependency scripts, and CDM job definitions. Send request POST /v1/{project_id}/jobs/{job_name}/export

func RetryInstance

func RetryInstance(client *golangsdk.ServiceClient, jobName, instanceId, workspace string) error

RetryInstance is used to retry a specific job instance. A job instance can be retried only when it is in the successful, failed, or canceled state. Send request POST /v1/{project_id}/jobs/{job_name}/instances/{instance_id}/restart

func Start

func Start(client *golangsdk.ServiceClient, jobName string, reqOpts *StartReq) error

Start is used to start a job. Send request POST /v1/{project_id}/jobs/{job_name}/start

func Stop

func Stop(client *golangsdk.ServiceClient, jobName, workspace string) error

Stop is used to stop a job. Send request POST /v1/{project_id}/jobs/{job_name}/stop

func StopInstance

func StopInstance(client *golangsdk.ServiceClient, jobName, instanceId, workspace string) error

StopInstance is used to stop a specific job instance. A job instance can be stopped only when it is in the running state. Send request POST /v1/{project_id}/jobs/{job_name}/instances/{instance_id}/stop

func Update

func Update(client *golangsdk.ServiceClient, jobName string, job Job) error

Update is used to edit a job. Send request PUT /v1/{project_id}/jobs/{job_name}

Types

type BasicConfig

type BasicConfig struct {
	// Job owner. The length cannot exceed 128 characters.
	Owner string `json:"owner,omitempty"`
	// Job priority. The value ranges from 0 to 2. The default value is 0. 0 indicates a top priority, 1 indicates a medium priority, and 2 indicates a low priority.
	Priority int `json:"priority,omitempty"`
	// Job execution user. The value must be an existing username.
	ExecuteUser string `json:"executeUser,omitempty"`
	// Instance timeout interval. The unit is minute. The value ranges from 5 to 1440. The default value is 60.
	InstanceTimeout int `json:"instanceTimeout,omitempty"`
	// User-defined field. The length cannot exceed 2048 characters.
	CustomFields map[string]string `json:"customFields,omitempty"`
}

type BatchExportReq

type BatchExportReq struct {
	// Workspace ID.
	Workspace string `json:"-"`
	// A list of jobs to be exported. A maximum of 100 jobs can be exported at a time.
	JobList []string `json:"jobList" required:"true"`
	// Specifies whether to export the scripts and resources that the job depends on.
	// Default value: true
	ExportDepend bool `json:"exportDepend,omitempty"`
}

type Condition

type Condition struct {
	// Name of the previous node on which the current node depends.
	PreNodeName string `json:"preNodeName" required:"true"`
	// EL expression. If the calculation result of the EL expression is true, this node is executed.
	Expression string `json:"expression" required:"true"`
}

type Cron

type Cron struct {
	// Scheduling start time in the format of yyyy-MM-dd'T'HH:mm:ssZ, which is an ISO 8601 time format. For example, 2018-10-22T23:59:59+08, which indicates that a job starts to be scheduled at 23:59:59 on October 22nd, 2018.
	StartTime string `json:"startTime" required:"true"`
	// Scheduling end time in the format of yyyy-MM-dd'T'HH:mm:ssZ, which is an ISO 8601 time format. For example, 2018-10-22T23:59:59+08, which indicates that a job stops to be scheduled at 23:59:59 on October 22nd, 2018. If the end time is not set, the job will continuously be executed based on the scheduling period.
	EndTime string `json:"endTime,omitempty"`
	// Cron expression in the format of <second><minute><hour><day><month><week>.
	Expression string `json:"expression" required:"true"`
	// Time zone corresponding to the Cron expression, for example, GMT+8.
	ExpressionTimeZone string `json:"expressionTimeZone,omitempty"`
	// Indicates whether to depend on the execution result of the current job's dependent job in the previous scheduling period.
	DependPrePeriod bool `json:"dependPrePeriod.,omitempty"`
	// Job dependency configuration.
	DependJobs *DependJobs `json:"dependJobs,omitempty"`
}

type CronTrigger

type CronTrigger struct {
	// Scheduling start time in the format of yyyy-MM-dd'T'HH:mm:ssZ, which is an ISO 8601 time format. For example, 2018-10-22T23:59:59+08, which indicates that a job starts to be scheduled at 23:59:59 on October 22nd, 2018.
	StartTime string `json:"startTime" required:"true"`
	// Scheduling end time in the format of yyyy-MM-dd'T'HH:mm:ssZ, which is an ISO 8601 time format. For example, 2018-10-22T23:59:59+08, which indicates that a job stops to be scheduled at 23:59:59 on October 22nd, 2018. If the end time is not set, the job will continuously be executed based on the scheduling period.
	EndTime string `json:"endTime,omitempty"`
	// Cron expression in the format of <second><minute><hour><day><month><week>.
	Expression string `json:"expression" required:"true"`
	// Time zone corresponding to the Cron expression, for example, GMT+8.
	ExpressionTimeZone string `json:"expressionTimeZone,omitempty"`
	// Job execution interval consisting of a time and time unit
	//
	// Example: 1 hours, 1 days, 1 weeks, 1 months
	Period string `json:"period" required:"true"`
	// Indicates whether to depend on the execution result of the current job's dependent job in the previous scheduling period.
	DependPrePeriod bool `json:"dependPrePeriod.,omitempty"`
	// Job dependency configuration.
	DependJobs *DependJobs `json:"dependJobs,omitempty"`
	// Number of concurrent executions allowed
	Concurrent int `json:"concurrent,omitempty"`
}

type DeleteReq

type DeleteReq struct {
	// Workspace ID.
	Workspace string        `json:"-"`
	Approvers []JobApprover `json:"approvers,omitempty"`
}

type DependJobs

type DependJobs struct {
	// A list of dependent jobs. Only the existing jobs can be depended on.
	Jobs []string `json:"jobs" required:"true"`
	// Dependency period.
	//    SAME_PERIOD: To run a job or not depends on the execution result of its depended job in the current scheduling period.
	//    PRE_PERIOD: To run a job or not depends on the execution result of its depended job in the previous scheduling period.
	// Default value: SAME_PERIOD
	DependPeriod string `json:"dependPeriod,omitempty"`
	// Dependency job failure policy.
	//    FAIL: Stop the job and set the job to the failed state.
	//    IGNORE: Continue to run the job.
	//    SUSPEND: Suspend the job.
	// Default value: FAIL
	DependFailPolicy string `json:"dependFailPolicy,omitempty"`
}

type Event

type Event struct {
	// Select the corresponding connection name and topic. When a new Kafka message is received, the job is triggered.
	// Set this parameter to KAFKA.
	// Event type. Currently, only newly reported data events from the DIS stream can be monitored. Each time a data record is reported, the job runs once.
	// This parameter is set to DIS.
	// Select the OBS path to be listened to. If new files exist in the path, scheduling is triggered. The path name can be referenced using variable Job.trigger.obsNewFiles. The prerequisite is that DIS notifications have been configured for the OBS path.
	// Set this parameter to OBS.
	EventType string `json:"eventType" required:"true"`
	// Job failure policy.
	//    SUSPEND: Suspend the event.
	//    IGNORE: Ignore the failure and process with the next event.
	// Default value: SUSPEND
	FailPolicy string `json:"failPolicy"`
	// Number of the concurrently scheduled jobs.
	// Value range: 1 to 128
	// Default value: 1
	Concurrent int `json:"concurrent"`
	// Access policy.
	//    LAST: Access data from the last location.
	//    NEW: Access data from a new location.
	// Default value: LAST
	ReadPolicy string `json:"readPolicy"`
}

type ExecuteImmediatelyReq

type ExecuteImmediatelyReq struct {
	// Workspace ID.
	Workspace string `json:"-"`
	// Parameters for executing a job immediately
	JobParams []*JobParam `json:"jobParams,omitempty"`
}

type ExecuteImmediatelyResp

type ExecuteImmediatelyResp struct {
	// Job instance ID.
	InstanceId int64 `json:"instanceId"`
}

func ExecuteImmediately

func ExecuteImmediately(client *golangsdk.ServiceClient, jobName string, reqOpts *ExecuteImmediatelyReq) (*ExecuteImmediatelyResp, error)

ExecuteImmediately is used to execute a job immediately and check whether the job can be executed successfully. Send request POST /v1/{project_id}/jobs/{job_name}/run-immediate

type GetJobFileParams

type GetJobFileParams struct {
	// If OBS is deployed, the job definition file is stored on OBS, for example, obs://myBucket/jobs.zip.
	Path string `json:"path,omitempty"`
}

type GetJobFileResp

type GetJobFileResp struct {
	// Job information.
	Jobs []*JobFile `json:"jobs,omitempty"`
	// Script information.
	Scripts []*Script `json:"scripts,omitempty"`
}

func GetJobFile

func GetJobFile(client *golangsdk.ServiceClient, opts *GetJobFileParams) (*GetJobFileResp, error)

GetJobFile is used to check whether there are jobs and scripts in the job file to be imported from OBS to DLF. Send request POST /v1/{project_id}/jobs/check-file

type GetJobInstanceListReq

type GetJobInstanceListReq struct {
	// Workspace ID.
	Workspace string `json:"-"`
	// Job name.
	//    If you want to query the instance list of a specific batch job, jobName is the batch job name.
	//    If you want to query sub-jobs associated with a node in a real-time job, the jobName format is real-time job name _ node name.
	JobName string `q:"jobName"`
	// Minimum planned job execution time in milliseconds. Job instances whose start time is greater than this time are returned.
	MinPlanTime int64 `q:"minPlanTime"`
	// Minimum planned job execution time in milliseconds. Job instances whose start time is less than this time are returned.
	MaxPlanTime int64 `q:"maxPlanTime"`
	// The maximum number of records on each page.
	// The parameter value ranges from 1 to 1000.
	// Default value: 10
	Limit int `q:"limit"`
	// Start page of the paging list. The default value is 0. The value must be greater than or equal to 0.
	Offset int `q:"offset"`
	// Job instance status.
	//    waiting
	//    running
	//    success
	//    fail
	//    running-exception
	//    pause
	//    manual-stop
	Status string `q:"status"`
	// Job scheduling modes.
	//    0: General scheduling
	//    2: Manual scheduling
	//    5: PatchData
	//    6: Subjob scheduling
	//    7: Schedule once
	InstanceType int `q:"instanceType"`
	// Whether exact search of jobs by name is supported
	PreciseQuery bool `q:"preciseQuery"`
}

type GetJobInstanceListResp

type GetJobInstanceListResp struct {
	// Total number of records.
	Total int `json:"total"`
	// Job instance status.
	Instances []*NodeStatusListResp `json:"instances"`
}

func GetJobInstanceList

func GetJobInstanceList(client *golangsdk.ServiceClient, reqOpts GetJobInstanceListReq) (*GetJobInstanceListResp, error)

GetJobInstanceList is used to view a job instance list.

A job instance is generated each time you run a batch job for which periodic scheduling or event-based scheduling is configured. If a real-time job contains a node for which periodic scheduling or event-based scheduling is configured, you can call this API to view the instance list of the subjobs associated with the node. The format of the jobName parameter is real-time job name_node name.

Send request GET /v1/{project_id}/jobs/instances/detail?jobName={jobName}&minPlanTime={minPlanTime}&maxPlanTime={maxPlanTime}&limit={limit}&offset={offset}&status={status}&instanceType={instanceType}&preciseQuery={preciseQuery}

type ImportReq

type ImportReq struct {
	// Workspace ID.
	Workspace string `json:"-"`
	// If OBS is deployed, it refers to the OBS path for storing the job definition file. For the format of the job definition file, see the response message of the exported job, for example, obs://myBucket/jobs.zip.
	Path string `json:"path" required:"true"`
	// Public job parameter.
	Params map[string]string `json:"params,omitempty"`
	// Policy for specifying how to handle duplicate names. The options are as follows:
	//    SKIP
	//    OVERWRITE
	// Default value: SKIP
	SameNamePolicy string `json:"sameNamePolicy,omitempty"`
	// Job parameter.
	JobsParam []*JobParamImported `json:"jobsParam,omitempty"`
	// User that executes the job.
	ExecuteUser string `json:"executeUser,omitempty"`
	// This parameter is required if the review function is enabled. It indicates the target status of the job. The value can be SAVED, SUBMITTED, or PRODUCTION.
	//    SAVED indicates that the job is saved but cannot be scheduled or executed. It can be executed only after submitted and approved.
	//    SUBMITTED indicates that the job is automatically submitted after it is saved and can be executed after it is approved.
	//    PRODUCTION indicates that the job can be directly executed after it is created. Note: Only the workspace administrator can create jobs in the PRODUCTION state.
	TargetStatus string `json:"targetStatus,omitempty"`
	// Job approver. This parameter is required if the review function is enabled.
	Approvers []*JobApprover `json:"approvers,omitempty"`
}

type ImportResp

type ImportResp struct {
	// ID of the task. Used to call the API for querying system tasks to obtain the import status.
	TaskId string `json:"taskId" required:"true"`
}

func ImportJob

func ImportJob(client *golangsdk.ServiceClient, reqOpts ImportReq) (*ImportResp, error)

ImportJob is used to import one or more job files from OBS to DLF. Send request POST /v1/{project_id}/jobs/import

type Job

type Job struct {
	// Workspace ID.
	Workspace string `json:"-"`
	// Job name. The name contains a maximum of 128 characters, including only letters, numbers, hyphens (-), underscores (_), and periods (.). The job name must be unique.
	Name string `json:"name" required:"true"`
	// Nodes is a node definition.
	// Nodes []Node `json:"nodes" required:"true"`
	Nodes []Node `json:"nodes,omitempty"`
	// Schedule is a scheduling configuration.
	Schedule Schedule `json:"schedule" required:"true"`
	// Job parameter definition.
	Params []*Param `json:"params,omitempty"`
	// Path of a job in the directory tree. If the directory of the path does not exist during job creation, a directory is automatically created in the root directory /, for example, /dir/a/.
	Directory string `json:"directory,omitempty"`
	// Job type.
	// REAL_TIME: real-time processing
	// BATCH: batch processing
	ProcessType string `json:"processType" required:"true"`
	// Job ID
	Id int64 `json:"id,omitempty"`
	// User who last updated the job
	LastUpdateUser string `json:"lastUpdateUser,omitempty"`
	// OBS path for storing job run logs
	LogPath string `json:"logPath,omitempty"`
	// Basic job information.
	BasicConfig *BasicConfig `json:"basicConfig,omitempty"`
	// This parameter is required if the review function is enabled. It indicates the target status of the job. The value can be SAVED, SUBMITTED, or PRODUCTION.
	TargetStatus string `json:"targetStatus,omitempty"`
	// Job approver. This parameter is required if the review function is enabled.
	Approvers []*JobApprover `json:"approvers,omitempty"`
}

func Get

func Get(client *golangsdk.ServiceClient, jobName, workspace string) (*Job, error)

Get is used to view job details. Send request GET /v1/{project_id}/jobs/{name}

type JobApprover

type JobApprover struct {
	// Approver name.
	ApproverName string `json:"approverName" required:"true"`
}

type JobFile

type JobFile struct {
	// Job parameter.
	Params map[string]string `json:"params,omitempty"`
	// Job name.
	Name string `json:"name"`
	// Path of the job.
	Path string `json:"path"`
}

type JobInstanceResp

type JobInstanceResp struct {
	// Job name.
	JobName string `json:"jobName"`
	// Job instance ID.
	InstanceId int64 `json:"instanceId"`
	// Job instance status.
	//    waiting
	//    running
	//    success
	//    fail
	//    running-exception
	//    pause
	//    manual-stop
	Status string `json:"status"`
	// Planned execution time of the job instance.
	PlanTime int64 `json:"planTime"`
	// Actual execution start time of the job instance.
	StartTime int64 `json:"startTime"`
	// Actual execution end time of the job instance.
	EndTime int64 `json:"endTime,omitempty"`
	// Execution duration in milliseconds.
	ExecuteTime int64 `json:"executeTime,omitempty"`
	// Total number of node records.
	Total int `json:"total"`
	// Node instance status.
	Nodes []NodeJobInstanceResp `json:"nodes"`
	// Whether the job instance status is forcibly successful
	//
	// Default value: false
	ForceSuccess bool `json:"forceSuccess,omitempty"`
	// Whether the job instance status is failure ignored
	//
	// Default value: false
	IgnoreSuccess bool `json:"ignoreSuccess,omitempty"`
}

func GetJobInstance

func GetJobInstance(client *golangsdk.ServiceClient, jobName, instanceId, workspace string) (*JobInstanceResp, error)

GetJobInstance is used to view job instance details, including the execution information about each node in a job instance. Send request GET /v1/{project_id}/jobs/{job_name}/instances/{instance_id}

type JobList

type JobList struct {
	// Job name.
	Name string `json:"name"`
	// Job type.
	//    REAL_TIME: real-time processing
	//    BATCH: batch processing
	JobType string `json:"jobType"`
	// Job owner. The length cannot exceed 128 characters.
	Owner string `json:"owner,omitempty"`
	// Job priority. The value ranges from 0 to 2. The default value is 0. 0 indicates a top priority, 1 indicates a medium priority, and 2 indicates a low priority.
	Priority int `json:"priority,omitempty"`
	// Job status.
	// When jobType is set to REAL_TIME, the status is as follows:
	//    STARTING
	//    NORMAL
	//    EXCEPTION
	//    STOPPING
	//    STOPPED
	//
	// When jobType is set to BATCH, the status is as follows:
	//    SCHEDULING
	//    STOPPED
	//    PAUSED
	Status string `json:"status"`
	// Job creator.
	CreateUser string `json:"createUser"`
	// Time when the job is created.
	CreateTime int64 `json:"createTime"`
	// Time when the job starts running.
	StartTime int64 `json:"startTime,omitempty"`
	// Time when the job stops running.
	EndTime int64 `json:"endTime,omitempty"`
	// Most recent running status of the job instance. This parameter is available only when jobType is set to BATCH.
	LastInstanceStatus string `json:"lastInstanceStatus,omitempty"`
	// Time when the most recent job instance stops to run. This parameter is available only when jobType is set to BATCH.
	LastInstanceEndTime int64 `json:"lastInstanceEndTime,omitempty"`
	// Time when the job was last updated.
	LastUpdateTime int64 `json:"lastUpdateTime,omitempty"`
	// User who last updated the job.
	LastUpdateUser string `json:"lastUpdateUser,omitempty"`
	// Path of the job.
	Path string `json:"path,omitempty"`
	// Whether the job is a single-task job.
	SingleNodeJobFlag bool `json:"singleNodeJobFlag,omitempty"`
}

type JobParam

type JobParam struct {
	// Name of the parameter. It cannot exceed 64 characters.
	Name string `json:"name" required:"true"`
	// Value of the parameter. It cannot exceed 1,024 characters.
	Value string `json:"value" required:"true"`
	// Parameter type
	//    variable
	//    constants
	ParamType string `json:"paramType,omitempty"`
}

type JobParamImported

type JobParamImported struct {
	Name   string            `json:"name" required:"true"`
	Params map[string]string `json:"params,omitempty"`
}

type ListOpts

type ListOpts struct {
	Offset  int    `q:"offset"`
	Limit   int    `q:"limit"`
	JobType string `q:"jobType"`
	JobName string `q:"jobName"`
}

type ListResp

type ListResp struct {
	// Total is the number of jobs.
	Total int `json:"total"`
	// Jobs is a list of jobs.
	Jobs []*JobList `json:"jobs"`
}

func List

func List(client *golangsdk.ServiceClient, opts ListOpts, workspace string) (*ListResp, error)

List is used to query a list of batch or real-time jobs. A maximum of 100 jobs can be returned for each query. Send request GET /v1/{project_id}/jobs?jobType={jobType}&offset={offset}&limit={limit}&jobName={jobName}

type Location

type Location struct {
	// Position of the node on the horizontal axis of the job canvas.
	X int `json:"x" required:"true"`
	// Position of the node on the vertical axis of the job canvas.
	Y int `json:"y" required:"true"`
}

type Node

type Node struct {
	// Node name. The name contains a maximum of 128 characters, including only letters, numbers, hyphens (-), underscores (_), and periods (.). Names of the nodes in a job must be unique.
	Name string `json:"name" required:"true"`
	// Node type. The options are as follows:
	//    Hive SQL: Runs Hive SQL scripts.
	//    Spark SQL: Runs Spark SQL scripts.
	//    DWS SQL: Runs DWS SQL scripts.
	//    DLI SQL: Runs DLI SQL scripts.
	//    Shell: Runs shell SQL scripts.
	//    CDM Job: Runs CDM jobs.
	//    CloudTable Manager: Manages CloudTable tables, including creating and deleting tables.
	//    OBS Manager: Manages OBS paths, including creating and deleting paths.
	//    RESTAPI: Sends REST API requests.
	//    SMN: Sends short messages or emails.
	//    MRS Spark: Runs Spark jobs of MRS.
	//    MapReduce: Runs MapReduce jobs of MRS.
	//    MRS Flink: Runs Flink jobs of MRS.
	//    MRS HetuEngine: Runs HetuEngine jobs of MRS.
	//    DLI Spark: Runs Spark jobs of DLF.
	//    RDS SQL: Transfers SQL statements to RDS for execution.
	Type string `json:"type" required:"true"`
	// Location of a node on the job canvas.
	Location Location `json:"location" required:"true"`
	// Name of the previous node on which the current node depends.
	PreNodeName []string `json:"preNodeName,omitempty"`
	// Node execution condition. Whether the node is executed or not depends on the calculation result of the EL expression saved in the expression field of condition.
	Conditions []*Condition `json:"conditions,omitempty"`
	// Node properties.
	Properties []*Property `json:"properties,omitempty" required:"true"`
	// Interval at which node running results are checked.
	// Unit: second; value range: 1 to 60
	// Default value: 10
	PollingInterval int `json:"pollingInterval,omitempty"`
	// Maximum execution time of a node. If a node is not executed within the maximum execution time, the node is set to the failed state.
	// Unit: minute; value range: 5 to 1440
	// Default value: 60
	MaxExecutionTime int `json:"maxExecutionTime,omitempty"`
	// Number of the node retries. The value ranges from 0 to 5. 0 indicates no retry.
	RetryTimes int `json:"retryTimes,omitempty"`
	// Interval at which a retry is performed upon a failure. The value ranges from 5 to 120.
	RetryInterval int `json:"retryInterval,omitempty"`
	// Node failure policy.
	//    FAIL: Terminate the execution of the current job.
	//    IGNORE: Continue to execute the next node.
	//    SUSPEND: Suspend the execution of the current job.
	//    FAIL_CHILD: Terminate the execution of the subsequent node.
	//    The default value is FAIL.
	FailPolicy string `json:"failPolicy,omitempty"`
	// Event trigger for the real-time job node.
	EventTrigger *Event `json:"eventTrigger,omitempty"`
	// Cron trigger for the real-time job node.
	CronTrigger *CronTrigger `json:"cronTrigger,omitempty"`
}

type NodeJobInstanceResp

type NodeJobInstanceResp struct {
	// Node name.
	NodeName string `json:"nodeName"`
	// Node status.
	//    waiting
	//    running
	//    success
	//    fail
	//    skip
	//    pause
	//    manual-stop
	Status string `json:"status,omitempty"`
	// Planned execution time of the job instance.
	PlanTime int64 `json:"planTime"`
	// Actual execution start time of the job instance.
	StartTime int64 `json:"startTime"`
	// Actual execution end time of the job instance.
	EndTime int64 `json:"endTime,omitempty"`
	// Node type.
	Type string `json:"type"`
	// Number of attempts upon a failure.
	RetryTimes int `json:"retryTimes,omitempty"`
	// Job instance ID.
	InstanceId int64 `json:"instanceId"`
	// Rows of input data.
	InputRowCount int64 `json:"inputRowCount,omitempty"`
	// Write speed (row/second)
	Speed float64 `json:"speed,omitempty"`
	// Path for storing node execution logs.
	LogPath string `json:"logPath,omitempty"`
}

type NodeStatusListResp

type NodeStatusListResp struct {
	// Job name. When you view the instance list of a specified batch job, jobName is the name of the batch job.
	// When you view the subjobs associated with a node in a real-time job, jobName is in format of real-time job name_node name.
	JobName string `json:"jobName"`
	// Job ID
	JobId int `json:"jobId,omitempty"`
	// Name of a job instance recorded by the log, rather than the name defined during job creation
	JobInstanceName string `json:"jobInstanceName"`
	// Job instance ID, which is used to query job instance details.
	InstanceId int64 `json:"instanceId"`
	// Job instance status.
	//    waiting
	//    running
	//    success
	//    fail
	//    running-exception
	//    pause
	//    manual-stop
	Status string `json:"status"`
	// Planned execution time of the job instance.
	PlanTime int64 `json:"planTime"`
	// Actual execution start time of the job instance.
	StartTime int64 `json:"startTime"`
	// Actual execution end time of the job instance.
	EndTime int64 `json:"endTime,omitempty"`
	// Execution duration in milliseconds.
	ExecuteTime int64 `json:"executeTime,omitempty"`

	// Time when a job is submitted.
	SubmitTime int64 `json:"submitTime"`
	// Node instance status.
	// Job scheduling modes.
	//    0: General scheduling
	//    2: Manual scheduling
	//    5: PatchData
	//    6: Subjob scheduling
	//    7: Schedule once
	InstanceType int `json:"instanceType"`
	// Whether the job instance status is forcibly successful
	//
	// Default value: false
	ForceSuccess bool `json:"forceSuccess,omitempty"`
	// Whether the job instance status is failure ignored
	//
	// Default value: false
	IgnoreSuccess bool `json:"ignoreSuccess,omitempty"`
	// Job instance version
	Version int `json:"version,omitempty"`
}

type NodeStatusResp

type NodeStatusResp struct {
	// Node name.
	Name string `json:"name"`
	// Node status.
	//    STARTING
	//    NORMAL
	//    EXCEPTION
	//    STOPPING
	//    STOPPED
	Status string `json:"status,omitempty"`
	// Path for storing node run logs.
	LogPath string `json:"logPath,omitempty"`
	// Node type.
	//    Hive SQL: Runs Hive SQL scripts.
	//    Spark SQL: Runs Spark SQL scripts.
	//    DWS SQL: Runs DWS SQL scripts.
	//    DLI SQL: Runs DLI SQL scripts.
	//    Shell: Runs shell SQL scripts.
	//    CDM Job: Runs CDM jobs.
	//    DIS Transfer Task: Creates DIS dump tasks.
	//    CS Job: Creates and starts CloudStream jobs.
	//    CloudTable Manager: Manages CloudTable tables, including creating and deleting tables.
	//    OBS Manager: Manages OBS paths, including creating and deleting paths.
	//    RESTAPI: Sends REST API requests.
	//    SMN: Sends short messages or emails.
	//    MRS Spark: Runs Spark jobs of MRS.
	//    MapReduce: Runs MapReduce jobs of MRS.
	Type string `json:"type"`
}

type Param

type Param struct {
	// Name of a parameter. The name contains a maximum of 64 characters, including only letters, numbers, hyphens (-), and underscores (_).
	Name string `json:"name" required:"true"`
	// Value of the parameter. It cannot exceed 1,024 characters.
	Value string `json:"value" required:"true"`
	// Parameter type
	//    variable
	//    constants
	//    Default value: variable
	Type string `json:"type,omitempty"`
}

type Property

type Property struct {
	// Property name
	Name string `json:"name" required:"true"`
	// Property value
	Value string `json:"value" required:"true"`
}

type RunningStatusResp

type RunningStatusResp struct {
	// Name of a solution.
	Name string `json:"name"`
	// Node status list.
	Nodes []*NodeStatusResp `json:"nodes,omitempty"`
	// Job status.
	//    STARTING
	//    NORMAL
	//    EXCEPTION
	//    STOPPING
	//    STOPPED
	Status string `json:"status,omitempty"`
	// Start time.
	StartTime time.Time `json:"startTime"`
	// End time.
	EndTime *time.Time `json:"endTime,omitempty"`
	// Last update time.
	LastUpdateTime *time.Time `json:"lastUpdateTime,omitempty"`
}

func GetRunningStatus

func GetRunningStatus(client *golangsdk.ServiceClient, jobName, workspace string) (*RunningStatusResp, error)

GetRunningStatus is used to view running status of a real-time job. Send request GET /v1/{project_id}/jobs/{job_name}/status

type Schedule

type Schedule struct {
	// Scheduling type.
	//    EXECUTE_ONCE: The job runs immediately and runs only once.
	//    CRON: The job runs periodically.
	//    EVENT: The job is triggered by events.
	Type string `json:"type" required:"true"`
	// When type is set to CRON, configure the scheduling frequency and start time.
	Cron *Cron `json:"cron,omitempty"`
	// When type is set to EVENT, configure information such as the event source.
	Event *Event `json:"event,omitempty"`
}

type Script

type Script struct {
	// Script name.
	Name string `json:"name"`
	// Path of the script.
	Path string `json:"path"`
}

type StartReq

type StartReq struct {
	// Workspace ID.
	Workspace string `json:"-"`
	// Parameter for starting the job.
	JobParams []*JobParam `json:"jobParams,omitempty"`
}

type SubTask

type SubTask struct {
	// Subtask ID.
	Id string `json:"id"`
	// Name of the subtask.
	Name string `json:"name"`
	// Time when the task was last updated.
	LastUpdate int64 `json:"lastUpdate"`
	// Task status.
	//    RUNNING
	//    SUCCESSFUL
	//    FAILED
	Status string `json:"status"`
	// Task information.
	TaskId string `json:"taskId,omitempty"`
}

type SystemTaskResp

type SystemTaskResp struct {
	// Task ID.
	Id string `json:"id"`
	// Name of the task.
	Name string `json:"name"`
	// Start time.
	StartTime int64 `json:"startTime"`
	// End time.
	EndTime int64 `json:"endTime,omitempty"`
	// Time when the task was last updated.
	LastUpdate int64 `json:"lastUpdate"`
	// Task status.
	//    RUNNING
	//    SUCCESSFUL
	//    FAILED
	Status string `json:"status"`
	// Project ID
	ProjectId string `json:"projectId,omitempty"`
	// Subtask.
	SubTasks []*SubTask `json:"subtasks,omitempty"`
}

func GetSystemTask

func GetSystemTask(client *golangsdk.ServiceClient, taskId, workspace string) (*SystemTaskResp, error)

GetSystemTask is used to query details about asynchronous tasks. Send request GET /v1/{project_id}/system-tasks/{task_id}

Jump to

Keyboard shortcuts

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