Updating function names per feedback.

This commit is contained in:
Aleksandr Melnikov
2020-05-21 22:19:42 -07:00
parent 1a9ce9870d
commit 860dc7398c
3 changed files with 13 additions and 11 deletions

View File

@@ -510,7 +510,7 @@ func (c *Client) createCronWorkflow(namespace string, workflowTemplateId *uint64
}
func (c *Client) TerminateCronWorkflow(namespace, uid string) (err error) {
err, cronWorkflow := c.SelectCronWorkflowWithExtraColumns(namespace, uid, "wtv.version")
err, cronWorkflow := c.SelectCronWorkflowWithWorkflowTemplateVersion(namespace, uid, "wtv.version")
if err != nil {
return err
}
@@ -529,11 +529,11 @@ func (c *Client) TerminateCronWorkflow(namespace, uid string) (err error) {
return err
}
err = c.DeleteCronWorkflowDb(namespace, uid)
err = c.ArchiveCronWorkflowDB(namespace, uid)
if err != nil {
return err
}
err = c.DeleteCronWorkflow(namespace, uid)
err = c.DeleteCronWorkflowK8S(namespace, uid)
if err != nil {
return err
}
@@ -660,7 +660,7 @@ func cronWorkflowColumns(extraColumns ...string) []string {
return results
}
func (c *Client) SelectCronWorkflowWithExtraColumns(namespace, uid string, extraColumns ...string) (error, *CronWorkflow) {
func (c *Client) SelectCronWorkflowWithWorkflowTemplateVersion(namespace, uid string, extraColumns ...string) (error, *CronWorkflow) {
query, args, err := sb.Select(cronWorkflowColumns(extraColumns...)...).
From("cron_workflows cw").
Join("workflow_template_versions wtv ON wtv.id = cw.workflow_template_version_id").
@@ -683,7 +683,7 @@ func (c *Client) SelectCronWorkflowWithExtraColumns(namespace, uid string, extra
return nil, cronWorkflow
}
func (c *Client) DeleteCronWorkflowDb(namespace, uid string) error {
func (c *Client) DeleteCronWorkflowDB(namespace, uid string) error {
query, args, err := sb.Select("id").From("cron_workflows").
Where(sq.Eq{
"uid": uid,
@@ -731,6 +731,8 @@ func (c *Client) ArchiveCronWorkflowDB(namespace, uid string) error {
}
return nil
}
func (c *Client) DeleteCronWorkflowK8S(namespace, uid string) error {
err := c.ArgoprojV1alpha1().CronWorkflows(namespace).Delete(uid, nil)
if err != nil {
if strings.Contains(err.Error(), "not found") {

View File

@@ -1464,7 +1464,7 @@ func (c *Client) getWorkflowExecutionAndTemplate(namespace string, uid string) (
return
}
func (c *Client) DeleteWorkflowExecution(namespace, uid string) error {
func (c *Client) DeleteWorkflowExecutionK8S(namespace, uid string) error {
err := c.ArgoprojV1alpha1().Workflows(namespace).Delete(uid, nil)
if err != nil {
if strings.Contains(err.Error(), "not found") {
@@ -1475,7 +1475,7 @@ func (c *Client) DeleteWorkflowExecution(namespace, uid string) error {
return nil
}
func (c *Client) DeleteWorkflowExecutionDb(workflowUid string) error {
func (c *Client) DeleteWorkflowExecutionDB(workflowUid string) error {
query, args, err := sb.Delete("workflow_executions").Where(sq.Eq{
"uid": workflowUid,
}).ToSql()

View File

@@ -628,7 +628,7 @@ func (c *Client) ArchiveWorkflowTemplate(namespace, uid string) (archived bool,
//clean up workflow templates
wfTempVer := strconv.FormatInt(workflowTemplate.Version, 10)
workflowTemplateName := uid + "-v" + wfTempVer
err = c.DeleteWorkflowTemplate(namespace, workflowTemplateName)
err = c.DeleteWorkflowTemplateK8S(namespace, workflowTemplateName)
if err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
@@ -689,7 +689,7 @@ func (c *Client) ArchiveWorkflowTemplate(namespace, uid string) (archived bool,
break
}
for _, wf := range wfs {
err = c.DeleteWorkflowExecution(namespace, wf.UID)
err = c.DeleteWorkflowExecutionK8S(namespace, wf.UID)
if err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
@@ -698,7 +698,7 @@ func (c *Client) ArchiveWorkflowTemplate(namespace, uid string) (archived bool,
}).Error("Delete Workflow Execution k8s failed.")
return false, util.NewUserError(codes.Unknown, "Unable to archive workflow template.")
}
err = c.DeleteWorkflowExecutionDb(wf.UID)
err = c.ArchiveWorkflowExecutionDB(namespace, wf.UID)
if err != nil {
log.WithFields(log.Fields{
"Namespace": namespace,
@@ -848,7 +848,7 @@ func (c *Client) GetWorkflowTemplateLabels(namespace, name, prefix string, versi
return
}
func (c *Client) DeleteWorkflowTemplate(namespace, uid string) error {
func (c *Client) DeleteWorkflowTemplateK8S(namespace, uid string) error {
err := c.ArgoprojV1alpha1().WorkflowTemplates(namespace).Delete(uid, nil)
if err != nil {
if strings.Contains(err.Error(), "not found") {