github.com/chnsz/golangsdk@v0.0.0-20240506093406-85a3fbfa605b/openstack/dli/v1/flinkjob/results.go (about)

     1  package flinkjob
     2  
     3  type CreateJobResp struct {
     4  	IsSuccess bool      `json:"is_success,string"`
     5  	Message   string    `json:"message"`
     6  	Job       JobStatus `json:"job"`
     7  }
     8  
     9  type JobStatus struct {
    10  	JobId      int    `json:"job_id"`
    11  	StatusName string `json:"status_name"`
    12  	StatusDesc string `json:"status_desc"`
    13  }
    14  
    15  type UpdateJobResp struct {
    16  	IsSuccess bool              `json:"is_success,string"`
    17  	Message   string            `json:"message"`
    18  	Job       UpdateJobResp_job `json:"job"`
    19  }
    20  
    21  type UpdateJobResp_job struct {
    22  	UpdateTime int `json:"update_time"`
    23  }
    24  
    25  type CommonResp struct {
    26  	IsSuccess bool   `json:"is_success,string"`
    27  	Message   string `json:"message"`
    28  }
    29  
    30  type GetJobResp struct {
    31  	IsSuccess bool   `json:"is_success,string"`
    32  	Message   string `json:"message"`
    33  	JobDetail Job    `json:"job_detail"`
    34  }
    35  
    36  type Job struct {
    37  	// Job ID.
    38  	JobId int `json:"job_id"`
    39  	// Name of the job. Length range: 0 to 57 characters.
    40  	Name string `json:"name"`
    41  	// Job description. Length range: 0 to 512 characters.
    42  	Desc string `json:"desc"`
    43  	// Job type.
    44  	// flink_sql_job: Flink SQL job
    45  	// flink_opensource_sql_job: Flink OpenSource SQL job
    46  	// flink_jar_job: User-defined Flink job
    47  	JobType string `json:"job_type"`
    48  	// Job status.
    49  	// Available job statuses are as follows:
    50  	// job_init: The job is in the draft status.
    51  	// job_submitting: The job is being submitted.
    52  	// job_submit_fail: The job fails to be submitted.
    53  	// job_running: The job is running. (The billing starts. After the job is submitted, a normal result is returned.)
    54  	// job_running_exception (The billing stops. The job stops running due to an exception.)
    55  	// job_downloading: The job is being downloaded.
    56  	// job_idle: The job is idle.
    57  	// job_canceling: The job is being stopped.
    58  	// job_cancel_success: The job has been stopped.
    59  	// job_cancel_fail: The job fails to be stopped.
    60  	// job_savepointing: The savepoint is being created.
    61  	// job_arrearage_stopped: The job is stopped because the account is in arrears.
    62  	//  (The billing ends. The job is stopped because the user account is in arrears.)
    63  	// job_arrearage_recovering: The recharged job is being restored.
    64  	//  (The account in arrears is recharged, and the job is being restored).
    65  	// job_finish: The job is completed.
    66  	Status string `json:"status"`
    67  	// Description of job status.
    68  	StatusDesc string `json:"status_desc"`
    69  	// Time when a job is created.
    70  	CreateTime int `json:"create_time"`
    71  	// Time when a job is started.
    72  	StartTime int `json:"start_time"`
    73  	// ID of the user who creates the job.
    74  	UserId string `json:"user_id"`
    75  	// Name of a queue. Length range: 1 to 128 characters.
    76  	QueueName string `json:"queue_name"`
    77  	// ID of the project to which a job belongs.
    78  	ProjectId string `json:"project_id"`
    79  	// Stream SQL statement.
    80  	SqlBody string `json:"sql_body"`
    81  	// Job running mode. The options are as follows:
    82  	// shared_cluster: indicates that the job is running on a shared cluster.
    83  	// exclusive_cluster: indicates that the job is running on an exclusive cluster.
    84  	// edge_node: indicates that the job is running on an edge node.
    85  	RunMode string `json:"run_mode"`
    86  	// Job configurations. Refer to Table 4 for details.
    87  	JobConfig JobConf `json:"job_config"`
    88  	// Main class of a JAR package, for example, org.apache.spark.examples.streaming.JavaQueueStream.
    89  	MainClass string `json:"main_class"`
    90  	// Running parameter of a JAR package job. Multiple parameters are separated by spaces.
    91  	EntrypointArgs string `json:"entrypoint_args"`
    92  	// Job execution plan.
    93  	ExecutionGraph string `json:"execution_graph"`
    94  	// Time when a job is updated.
    95  	UpdateTime int `json:"update_time"`
    96  	// User-defined job feature. Type of the Flink image used by a job.
    97  	// basic: indicates that the basic Flink image provided by DLI is used.
    98  	// custom: indicates that the user-defined Flink image is used.
    99  	Feature string `json:"feature"`
   100  	// Flink version. This parameter is valid only when feature is set to basic. You can use this parameter with the
   101  	// feature parameter to specify the version of the DLI basic Flink image used for job running.
   102  	FlinkVersion string `json:"flink_version"`
   103  	// Custom image. The format is Organization name/Image name:Image version.
   104  	// This parameter is valid only when feature is set to custom. You can use this parameter with the feature
   105  	// parameter to specify a user-defined Flink image for job running. For details about how to use custom images.
   106  	Image string `json:"image"`
   107  }
   108  
   109  type JobConfBase struct {
   110  	// Whether to enable the automatic job snapshot function.
   111  	// true: The automatic job snapshot function is enabled.
   112  	// false: The automatic job snapshot function is disabled.
   113  	// The default value is false.
   114  	CheckpointEnabled bool `json:"checkpoint_enabled"`
   115  	// Snapshot mode. There are two options:
   116  	// exactly_once: indicates that data is processed only once.
   117  	// at_least_once: indicates that data is processed at least once.
   118  	// The default value is exactly_once.
   119  	CheckpointMode string `json:"checkpoint_mode"`
   120  	// Snapshot interval. The unit is second. The default value is 10.
   121  	CheckpointInterval int `json:"checkpoint_interval"`
   122  	// Whether to enable the log storage function. The default value is false.
   123  	LogEnabled bool `json:"log_enabled"`
   124  	// Name of an OBS bucket.
   125  	ObsBucket string `json:"obs_bucket"`
   126  	// SMN topic name. If a job fails, the system will send a message to users subscribed to the SMN topic.
   127  	SmnTopic string `json:"smn_topic"`
   128  	// Parent job ID.
   129  	RootId int `json:"root_id"`
   130  	// List of edge computing group IDs. Use commas (,) to separate multiple IDs.
   131  	EdgeGroupIds []string `json:"edge_group_ids"`
   132  	// Number of CUs of the management unit. The default value is 1.
   133  	ManagerCuNumber int `json:"manager_cu_number"`
   134  	// Number of CUs selected for a job. This parameter is valid only when show_detail is set to true.
   135  	// Minimum value: 2
   136  	// Maximum value: 400
   137  	// The default value is 2.
   138  	CuNumber int `json:"cu_number"`
   139  	// Number of concurrent jobs set by a user. This parameter is valid only when show_detail is set to true.
   140  	// Minimum value: 1
   141  	// Maximum value: 2000
   142  	// The default value is 1.
   143  	ParallelNumber int `json:"parallel_number"`
   144  	// Whether to enable the function of restart upon exceptions.
   145  	RestartWhenException bool `json:"restart_when_exception"`
   146  	// Expiration time.
   147  	IdleStateRetention int `json:"idle_state_retention"`
   148  	// Name of the package that has been uploaded to the DLI resource management system. The UDF Jar file of the SQL
   149  	// job is uploaded through this parameter.
   150  	UdfJarUrl string `json:"udf_jar_url"`
   151  	// Dirty data policy of a job.
   152  	// 2:obsDir: Save. obsDir specifies the path for storing dirty data.
   153  	// 1: Trigger a job exception
   154  	// 0: Ignore
   155  	DirtyDataStrategy string `json:"dirty_data_strategy"`
   156  	// Name of the package that has been uploaded to the DLI resource management system.
   157  	// This parameter is used to customize the JAR file where the job main class is located.
   158  	Entrypoint string `json:"entrypoint"`
   159  	// Name of the package that has been uploaded to the DLI resource management system.
   160  	// This parameter is used to customize other dependency packages.
   161  	DependencyJars []string `json:"dependency_jars"`
   162  	// Name of the resource package that has been uploaded to the DLI resource management system.
   163  	// This parameter is used to customize dependency files.
   164  	DependencyFiles []string `json:"dependency_files"`
   165  	// Number of compute nodes in a job.
   166  	ExecutorNumber int `json:"executor_number"`
   167  	// Number of CUs in a compute node.
   168  	ExecutorCuNumber int `json:"executor_cu_number"`
   169  	// Whether to restore data from the latest checkpoint when the system automatically restarts upon an exception.
   170  	// The default value is false.
   171  	ResumeCheckpoint bool   `json:"resume_checkpoint"`
   172  	TmCus            int    `json:"tm_cus"`
   173  	TmSlotNum        int    `json:"tm_slot_num"`
   174  	ResumeMaxNum     int    `json:"resume_max_num"`
   175  	CheckpointPath   string `json:"checkpoint_path"`
   176  	Feature          string `json:"feature"`
   177  	FlinkVersion     string `json:"flink_version"`
   178  	Image            string `json:"image"`
   179  	// Degree of parallelism (DOP) of an operator.
   180  	OperatorConfig string `json:"operator_config"`
   181  	// The traffic or hit rate configuration of each operator.
   182  	StaticEstimatorConfig string `json:"static_estimator_config"`
   183  }
   184  
   185  type ListResp struct {
   186  	IsSuccess bool          `json:"is_success,string"`
   187  	Message   string        `json:"message"`
   188  	JobList   JobListWapper `json:"job_list"`
   189  }
   190  
   191  type JobListWapper struct {
   192  	TotalCount int        `json:"total_count"`
   193  	Jobs       []Job4List `json:"jobs"`
   194  }
   195  
   196  type Job4List struct {
   197  	JobId int    `json:"job_id"`
   198  	Name  string `json:"name"`
   199  	Desc  string `json:"desc"`
   200  	// Job description. Length range: 0 to 512 characters.
   201  	Username   string `json:"username"`
   202  	JobType    string `json:"job_type"`
   203  	Status     string `json:"status"`
   204  	StatusDesc string `json:"status_desc"`
   205  	CreateTime int    `json:"create_time"`
   206  	StartTime  int    `json:"start_time"`
   207  	// Running duration of a job. Unit: ms. This parameter is valid only when show_detail is set to false.
   208  	Duration int `json:"duration"`
   209  	// Parent job ID. This parameter is valid only when show_detail is set to false.
   210  	RootId int `json:"root_id"`
   211  	// ID of the user who creates the job. This parameter is valid only when show_detail is set to true.
   212  	UserId string `json:"user_id"`
   213  	// This parameter is valid only when show_detail is set to true.
   214  	ProjectId string `json:"project_id"`
   215  	// Stream SQL statement. This parameter is valid only when show_detail is set to false.
   216  	SqlBody string `json:"sql_body"`
   217  	// Job running mode. The options are as follows: The value can be shared_cluster, exclusive_cluster, or edge_node.
   218  	// This parameter is valid only when show_detail is set to true.
   219  	// shared_cluster: indicates that the job is running on a shared cluster.
   220  	// exclusive_cluster: indicates that the job is running on an exclusive cluster.
   221  	// edge_node: indicates that the job is running on an edge node.
   222  	RunMode string `json:"run_mode"`
   223  	// Job configuration. This parameter is valid only when show_detail is set to false.
   224  	JobConfig JobConfBase `json:"job_config"`
   225  	//Main class of a JAR package. This parameter is valid only when show_detail is set to false.
   226  	MainClass string `json:"main_class"`
   227  	// Job running parameter of the JAR file. Multiple parameters are separated by spaces.
   228  	// This parameter is valid only when show_detail is set to true.
   229  	EntrypointArgs string `json:"entrypoint_args"`
   230  	// Job execution plan. This parameter is valid only when show_detail is set to false.
   231  	ExecutionGraph string `json:"execution_graph"`
   232  	// Time when a job is updated. This parameter is valid only when show_detail is set to false.
   233  	UpdateTime int `json:"update_time"`
   234  }
   235  
   236  type JobConf struct {
   237  	JobConfBase
   238  	// Customizes optimization parameters when a Flink job is running.
   239  	RuntimeConfig string `json:"runtime_config"`
   240  }
   241  
   242  type DliError struct {
   243  	ErrorCode string `json:"error_code"`
   244  	ErrorMsg  string `json:"error_msg"`
   245  }