Skip to content

Commit

Permalink
Merge pull request volcano-sh#238 from Rajadeepan/events
Browse files Browse the repository at this point in the history
Adding Events for Action
  • Loading branch information
volcano-sh-bot authored Jun 24, 2019
2 parents b91a667 + 4e48688 commit 1c55eb9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/apis/batch/v1alpha1/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ const (
PVCError JobEvent = "PVCError"
// PodGroupError pod grp error event is generated if error happens during pod grp creation
PodGroupError JobEvent = "PodGroupError"
//ExecuteAction action issued event for each action
ExecuteAction JobEvent = "ExecuteAction"
)

// Event represent the phase of Job, e.g. pod-failed.
Expand Down
8 changes: 8 additions & 0 deletions pkg/controllers/job/job_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ limitations under the License.
package job

import (
"fmt"

"github.com/golang/glog"

"k8s.io/api/core/v1"
Expand All @@ -38,6 +40,7 @@ import (
kbinfo "github.com/kubernetes-sigs/kube-batch/pkg/client/informers/externalversions/scheduling/v1alpha1"
kblister "github.com/kubernetes-sigs/kube-batch/pkg/client/listers/scheduling/v1alpha1"

vkbatchv1 "volcano.sh/volcano/pkg/apis/batch/v1alpha1"
vkver "volcano.sh/volcano/pkg/client/clientset/versioned"
vkscheme "volcano.sh/volcano/pkg/client/clientset/versioned/scheme"
vkinfoext "volcano.sh/volcano/pkg/client/informers/externalversions"
Expand Down Expand Up @@ -239,6 +242,11 @@ func (cc *Controller) processNextReq() bool {
glog.V(3).Infof("Execute <%v> on Job <%s/%s> in <%s> by <%T>.",
action, req.Namespace, req.JobName, jobInfo.Job.Status.State.Phase, st)

if action != vkbatchv1.SyncJobAction {
cc.recordJobEvent(jobInfo.Job.Namespace, jobInfo.Job.Name, vkbatchv1.ExecuteAction, fmt.Sprintf(
"Start to execute action %s ", action))
}

if err := st.Execute(action); err != nil {
glog.Errorf("Failed to handle Job <%s/%s>: %v",
jobInfo.Job.Namespace, jobInfo.Job.Name, err)
Expand Down

0 comments on commit 1c55eb9

Please sign in to comment.