volcano.sh/volcano@v1.9.0/pkg/controllers/apis/request.go (about) 1 /* 2 Copyright 2019 The Volcano Authors. 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package apis 18 19 import ( 20 "fmt" 21 22 "volcano.sh/apis/pkg/apis/bus/v1alpha1" 23 flowv1alpha1 "volcano.sh/apis/pkg/apis/flow/v1alpha1" 24 ) 25 26 // Request struct. 27 type Request struct { 28 Namespace string 29 JobName string 30 TaskName string 31 QueueName string 32 33 Event v1alpha1.Event 34 ExitCode int32 35 Action v1alpha1.Action 36 JobVersion int32 37 } 38 39 // String function returns the request in string format. 40 func (r Request) String() string { 41 return fmt.Sprintf( 42 "Queue: %s, Job: %s/%s, Task:%s, Event:%s, ExitCode:%d, Action:%s, JobVersion: %d", 43 r.QueueName, r.Namespace, r.JobName, r.TaskName, r.Event, r.ExitCode, r.Action, r.JobVersion) 44 } 45 46 // FlowRequest The object of sync operation, used for JobFlow and JobTemplate 47 type FlowRequest struct { 48 Namespace string 49 JobFlowName string 50 JobTemplateName string 51 52 Action flowv1alpha1.Action 53 Event flowv1alpha1.Event 54 } 55 56 func (r FlowRequest) String() string { 57 return fmt.Sprintf( 58 "JobTemplate: %s, JobFlow: %s/%s", 59 r.JobTemplateName, r.JobFlowName, r.Namespace) 60 }