- 
                Notifications
    You must be signed in to change notification settings 
- Fork 64
Skipping MCAD CPU Preemption Test #696
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
          
     Open
      
      
            Fiona-Waters
  wants to merge
  29
  commits into
  project-codeflare:main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
Fiona-Waters:skip-flaky-e2e
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Open
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            29 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      701e8e9
              
                Adding skip to flaky tests
              
              
                Fiona-Waters 4db97fb
              
                use only 2 cpus
              
              
                asm582 f5f6743
              
                add dockerd cmd
              
              
                asm582 816733a
              
                remove kind resource config
              
              
                asm582 41961a9
              
                add docker res config
              
              
                asm582 f8a91da
              
                debug docker res config-1
              
              
                asm582 2d8401c
              
                debug docker res config-2
              
              
                asm582 fa08868
              
                debug docker res config-3
              
              
                asm582 b7917d6
              
                debug docker res config-4
              
              
                asm582 265214a
              
                debug docker res config-5
              
              
                asm582 2ff4f37
              
                debug docker res config-6
              
              
                asm582 25e6ec1
              
                debug docker res config-7
              
              
                asm582 fba9c92
              
                debug docker res config-8
              
              
                asm582 1182c22
              
                debug docker res config-9
              
              
                asm582 b45b7af
              
                debug docker res config-10
              
              
                asm582 58aa461
              
                debug docker res config-11
              
              
                asm582 65f9a8e
              
                debug docker res config-12
              
              
                asm582 105f3ff
              
                debug docker res config-13
              
              
                asm582 8f536c0
              
                debug docker res config-14
              
              
                asm582 45345be
              
                debug docker res config-15
              
              
                asm582 10bb865
              
                debug docker res config-16
              
              
                asm582 fddcc58
              
                debug docker res config-17
              
              
                asm582 40648bb
              
                debug docker res config-18
              
              
                asm582 73f374e
              
                debug docker res config-19
              
              
                asm582 dd1c862
              
                debug docker res config-20
              
              
                asm582 a991ddc
              
                debug docker res config-21
              
              
                asm582 883e04a
              
                debug docker res config-22
              
              
                asm582 ff376f5
              
                fix failing test
              
              
                asm582 8eeaaf8
              
                fix test 2
              
              
                asm582 File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|  | @@ -40,6 +40,8 @@ import ( | |||||
|  | ||||||
| arbv1 "github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/controller/v1beta1" | ||||||
| versioned "github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/client/clientset/versioned" | ||||||
| "github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/controller/clusterstate/api" | ||||||
| clusterstateapi "github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/controller/clusterstate/api" | ||||||
| ) | ||||||
|  | ||||||
| var ninetySeconds = 90 * time.Second | ||||||
|  | @@ -793,6 +795,36 @@ func createDeploymentAWwith550CPU(context *context, name string) *arbv1.AppWrapp | |||||
| return appwrapper | ||||||
| } | ||||||
|  | ||||||
| func getClusterCapacitycontext(context *context) *clusterstateapi.Resource { | ||||||
| capacity := clusterstateapi.EmptyResource() | ||||||
| nodes, _ := context.kubeclient.CoreV1().Nodes().List(context.ctx, metav1.ListOptions{}) | ||||||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should handle the error here. | ||||||
| for _, node := range nodes.Items { | ||||||
| // skip unschedulable nodes | ||||||
| if node.Spec.Unschedulable { | ||||||
| continue | ||||||
| } | ||||||
| nodeResource := clusterstateapi.NewResource(node.Status.Allocatable) | ||||||
| capacity.Add(nodeResource) | ||||||
| var specNodeName = "spec.nodeName" | ||||||
| labelSelector := fmt.Sprintf("%s=%s", specNodeName, node.Name) | ||||||
| podList, err := context.kubeclient.CoreV1().Pods("").List(context.ctx, metav1.ListOptions{FieldSelector: labelSelector}) | ||||||
| // TODO: when no pods are listed, do we send entire node capacity as available | ||||||
| // this will cause false positive dispatch. | ||||||
| if err != nil { | ||||||
| There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the error be caught like this instead? 
        Suggested change
       
 | ||||||
| fmt.Errorf("[allocatableCapacity] Error listing pods %v", err) | ||||||
| } | ||||||
| for _, pod := range podList.Items { | ||||||
| if _, ok := pod.GetLabels()["appwrappers.mcad.ibm.com"]; !ok && pod.Status.Phase != v1.PodFailed && pod.Status.Phase != v1.PodSucceeded { | ||||||
| for _, container := range pod.Spec.Containers { | ||||||
| usedResource := clusterstateapi.NewResource(container.Resources.Requests) | ||||||
| capacity.Sub(usedResource) | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| return capacity | ||||||
| } | ||||||
|  | ||||||
| func createDeploymentAWwith350CPU(context *context, name string) *arbv1.AppWrapper { | ||||||
| rb := []byte(`{"apiVersion": "apps/v1", | ||||||
| "kind": "Deployment", | ||||||
|  | @@ -2705,3 +2737,9 @@ func AppWrapper(context *context, namespace string, name string) func(g gomega.G | |||||
| func AppWrapperState(aw *arbv1.AppWrapper) arbv1.AppWrapperState { | ||||||
| return aw.Status.State | ||||||
| } | ||||||
|  | ||||||
| func cpuDemand(cap *api.Resource, fractionOfCluster float64) *resource.Quantity { | ||||||
| //klog.Infof("[allocatableCapacity] The available capacity to dispatch appwrapper is %v and time took to calculate is %v", capacity, time.Since(startTime)) | ||||||
| milliDemand := int64(float64(cap.MilliCPU) * fractionOfCluster) | ||||||
| return resource.NewMilliQuantity(milliDemand, resource.DecimalSI) | ||||||
| } | ||||||
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What happens if the cluster has many smaller nodes resulting a a high
capbut inability to schedule AppWrappers becauase they do not fit on the individual nodes? Do we care about that at all in this test case?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From a test case perspective, the cluster is assumed to have homogenous nodes and it requests deployments that fit on a node in the cluster in CPU dimension.