func (j *Job) save() {
	collection := GetJobsCollectionName(j.Deployment)
	bytes, _ := j.Serialize()
	timestamp := utils.UTCDateString()
	err := store.Client().Put(collection, timestamp, bytes)
	if err != nil {
		logger.Errorf("Unhandled error when inserting job into the db, %s", err)
		return
	}
}
save : store the job
package job
import (
	"container/heap"
	"encoding/json"
	"fmt"
	"strings"
	"time"
	"github.com/krane/krane/internal/constants"
	"github.com/krane/krane/internal/logger"
	"github.com/krane/krane/internal/store"
	"github.com/krane/krane/internal/utils"
)
type Job struct {
	ID          string         `json:"id"`                
	Deployment  string         `json:"deployment"`        
	Type        string         `json:"type"`              
	Status      Status         `json:"status"`            
	State       State          `json:"state"`             
	StartTime   int64          `json:"start_time_epoch"`  
	EndTime     int64          `json:"end_time_epoch"`    
	RetryPolicy uint           `json:"retry_policy"`      
	Args        interface{}    `json:"-"`                 
	Setup       GenericHandler `json:"-"`                 
	Run         GenericHandler `json:"-"`                 
	Finally     GenericHandler `json:"-"`                 
}
type GenericHandler func(args interface{}) error
func (j *Job) Serialize() ([]byte, error) { return json.Marshal(j) }
func (j *Job) start() {
	if j.State == Started {
		return
	}
	j.StartTime = time.Now().Unix()
	j.State = Started
	j.Status.Failures = []Error{}
}
func (j *Job) end() {
	if j.State != Started {
		return
	}
	j.EndTime = time.Now().Unix()
	j.State = Completed
	j.save()
}