Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement ExecutionProgress method on Kanister functions #2117

Merged

Conversation

PrasadG193
Copy link
Contributor

Change Overview

This PR implements ExecutionProgress() on Kanister functions to address the interface changes introduced in #2023 to report progress tracking by each function

This PR is part of #2023, split to make it easier for review

Pull request type

Please check the type of change your PR introduces:

  • 🚧 Work in Progress
  • 🌈 Refactoring (no functional changes, no api changes)
  • 🐹 Trivial/Minor
  • 🐛 Bugfix
  • 🌻 Feature
  • 🗺️ Documentation
  • 🤖 Test

Test Plan

Added in #2023

@github-actions
Copy link
Contributor

Thanks for submitting this pull request 🎉. The team will review it soon and get back to you.

If you haven't already, please take a moment to review our project contributing guideline and Code of Conduct document.

Comment on lines +79 to +80
b.progressPercent = progress.StartedPercent
defer func() { b.progressPercent = progress.CompletedPercent }()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, we are going to set the progress to 100 even if the function execution failed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@viveksinghggits in case of failure, the phase progress is set to nil. Here is an example from tests where out of 3, first phase completed but second phase fails

status:                                                                                                                                                                                                     
  actions:                                                                                                                                                                                                            
  - artifacts:                                                                                                                                                                                                        
      operatorBackup:                                                                                                                                                                                                 
        keyValue:                                                                                                                                                                                                     
          path: '{{ .Phases.phase3.Output.path }}'                                                                                                                                                                    
    blueprint: operator-blueprint                                                                                                                                                                                     
    deferPhase:                                                                                                                                                                                                       
      name: ""                                                                                                                                                                                                        
      progress: {}                                                                                                                                                                                                    
      state: ""                                                                                                                                                                                                       
    name: backup                                                                                                                                                                                                      
    object:                                                                                                                                                                                                           
      apiVersion: v1                                                                                                                                                                                                  
      group: apps                                                                                                                                                                                                     
      kind: statefulset                                                                                                                                                                                               
      name: mysql                                                                                                                                                                                                     
      namespace: mysql                                                                                                                                                                                                
      resource: statefulsets                                                                                                                                                                                          
    phases:                                                                                                                                                                                                           
    - name: phase1                                                                                                                                                                                                    
      output:                                                                                                                                                                                                         
        path: /operator-backups/2023-05-22T07-32-36/backup.tgz                                                                                                                                                        
      progress:                                                                                                                                                                                                       
        lastTransitionTime: "2023-05-22T07:32:54Z"                                                                                                                                                                    
        progressPercent: "100"                                                                                                                                                                                         
      state: complete                                                                                                                                                                                                 
    - name: phase2                                                                                                                                                                                                    
      progress: {}                                                                                                                                                                                                    
      state: failed                                                                                                                                                                                                   
    - name: phase3                                                                                                                                                                                                    
      progress: {}                                                                                                                                                                                                    
      state: pending                                                                                                                                                                                                  
  error:                                                                                                                                                                                                              
    message: "Failed while waiting for Pod kanister-job-sk2bk to complete: Pod failed                                                                                                                                 
      or did not transition into complete state: Running backup\
     .
     .
  progress:                                                                                                                                                             
    lastTransitionTime: "2023-05-22T07:32:54Z"                                          
    percentCompleted: "33"                                                           
  state: failed        

pkg/function/delete_csi_snapshot_content.go Outdated Show resolved Hide resolved
@pavannd1
Copy link
Contributor

Will take a look at this soon 👀

pkg/function/backup_data.go Outdated Show resolved Hide resolved
@PrasadG193 PrasadG193 force-pushed the phase-progress-interface-implement branch from a9b5fee to 204c67d Compare September 26, 2023 06:47
@PrasadG193 PrasadG193 merged commit 5822e8d into phase-progress-interface Sep 26, 2023
@PrasadG193 PrasadG193 deleted the phase-progress-interface-implement branch September 26, 2023 06:53
mergify bot added a commit that referenced this pull request Oct 3, 2023
…rogress (#2023)

* Add phase level progress fields in actionset object

Signed-off-by: Prasad Ghangal <[email protected]>

* Change weight based progress calc with func implementation

Signed-off-by: Prasad Ghangal <[email protected]>

* Refactor and add unit tests for phase progress

Signed-off-by: Prasad Ghangal <[email protected]>

* Update generated deepcopy methods

Signed-off-by: Prasad Ghangal <[email protected]>

* Fix import cycle issue in test

Signed-off-by: Prasad Ghangal <[email protected]>

* Update pkg/apis/cr/v1alpha1/types.go

Co-authored-by: Pavan Navarathna <[email protected]>

* Update pkg/apis/cr/v1alpha1/types.go

Co-authored-by: Pavan Navarathna <[email protected]>

* Update pkg/apis/cr/v1alpha1/types.go

Co-authored-by: Pavan Navarathna <[email protected]>

* Update pkg/apis/cr/v1alpha1/types.go

Co-authored-by: Pavan Navarathna <[email protected]>

* Use correct action index while updating action phase state

Signed-off-by: Prasad Ghangal <[email protected]>

* Implement ExecutionProgress method on Kanister functions (#2117)

* Implement ExecutionProgress method on Kanister functions

Signed-off-by: Prasad Ghangal <[email protected]>

* Set LastTransitionTime in ExecutionProgress return

Signed-off-by: Prasad Ghangal <[email protected]>

* Update pkg/function/backup_data.go

Co-authored-by: Pavan Navarathna <[email protected]>

---------

Signed-off-by: Prasad Ghangal <[email protected]>
Co-authored-by: Pavan Navarathna <[email protected]>

* Implement ExecProgress on test function

Signed-off-by: Prasad Ghangal <[email protected]>

* Remove unused mockPhase in test

Signed-off-by: Prasad Ghangal <[email protected]>

* Remove unnecessary whitespace in updateActionProgress func

Signed-off-by: Prasad Ghangal <[email protected]>

---------

Signed-off-by: Prasad Ghangal <[email protected]>
Signed-off-by: Prasad Ghangal <[email protected]>
Co-authored-by: Pavan Navarathna <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
leuyentran pushed a commit that referenced this pull request Oct 18, 2023
…rogress (#2023)

* Add phase level progress fields in actionset object

Signed-off-by: Prasad Ghangal <[email protected]>

* Change weight based progress calc with func implementation

Signed-off-by: Prasad Ghangal <[email protected]>

* Refactor and add unit tests for phase progress

Signed-off-by: Prasad Ghangal <[email protected]>

* Update generated deepcopy methods

Signed-off-by: Prasad Ghangal <[email protected]>

* Fix import cycle issue in test

Signed-off-by: Prasad Ghangal <[email protected]>

* Update pkg/apis/cr/v1alpha1/types.go

Co-authored-by: Pavan Navarathna <[email protected]>

* Update pkg/apis/cr/v1alpha1/types.go

Co-authored-by: Pavan Navarathna <[email protected]>

* Update pkg/apis/cr/v1alpha1/types.go

Co-authored-by: Pavan Navarathna <[email protected]>

* Update pkg/apis/cr/v1alpha1/types.go

Co-authored-by: Pavan Navarathna <[email protected]>

* Use correct action index while updating action phase state

Signed-off-by: Prasad Ghangal <[email protected]>

* Implement ExecutionProgress method on Kanister functions (#2117)

* Implement ExecutionProgress method on Kanister functions

Signed-off-by: Prasad Ghangal <[email protected]>

* Set LastTransitionTime in ExecutionProgress return

Signed-off-by: Prasad Ghangal <[email protected]>

* Update pkg/function/backup_data.go

Co-authored-by: Pavan Navarathna <[email protected]>

---------

Signed-off-by: Prasad Ghangal <[email protected]>
Co-authored-by: Pavan Navarathna <[email protected]>

* Implement ExecProgress on test function

Signed-off-by: Prasad Ghangal <[email protected]>

* Remove unused mockPhase in test

Signed-off-by: Prasad Ghangal <[email protected]>

* Remove unnecessary whitespace in updateActionProgress func

Signed-off-by: Prasad Ghangal <[email protected]>

---------

Signed-off-by: Prasad Ghangal <[email protected]>
Signed-off-by: Prasad Ghangal <[email protected]>
Co-authored-by: Pavan Navarathna <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants