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

Handle null usage intervals in duration computing #1680

Conversation

sumanthgenz
Copy link
Collaborator

For clusters that are very old and have no history due to being present before changes to cluster_history tracking for sky cost-report, we return zero duration and cost as a form of error-handling.

Tested (run the relevant ones):

Simulated null usage intervals and start times and triggered the error-handling as seen below:

(sky) sumanth@MacBook-Pro-5 skypilot % sky cost-report
Clusters
NAME     LAUNCHED      DURATION  RESOURCES                          HOURLY_PRICE  COST (est.)  
cluster  2 weeks ago   -         1x GCP(n1-highmem-8, {'V100': 1})  $ 2.953       -            
cluster  2 weeks ago   -         1x GCP(n1-highmem-8, {'V100': 1})  $ 2.953       -            
cluster  1 month ago   -         1x GCP(n1-highmem-8)               $ 0.473       -            
cluster  1 month ago   -         1x GCP(n1-highmem-8)               $ 0.473       -            
min      2 months ago  -         1x AWS(m6i.2xlarge)                $ 0.384       -            
min      2 months ago  -         1x AWS(m6i.2xlarge)                $ 0.384       -            
mount    2 months ago  -         1x GCP(n1-highmem-8)               $ 0.473       -            
mount2   2 months ago  -         1x GCP(n1-highmem-8)               $ 0.473       -            
mount    2 months ago  -         1x GCP(n1-highmem-8)               $ 0.473       -            

Managed spot controller (will be autostopped if idle for 10min)
NAME                          LAUNCHED    DURATION  RESOURCES                          HOURLY_PRICE  COST (est.)  
sky-spot-controller-d16122f1  3 days ago  -         1x AWS(m6i.2xlarge, disk_size=50)  $ 0.384       -  

Copy link
Collaborator

@Michaelvll Michaelvll left a comment

Choose a reason for hiding this comment

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

Thanks for the quick fix @sumanthgenz! Left two comments.

@@ -426,11 +426,16 @@ def _get_cluster_launch_time(cluster_hash: str) -> Optional[Dict[str, Any]]:


def _get_cluster_duration(cluster_hash: str) -> Optional[Dict[str, Any]]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we update the return value type hint?

Comment on lines 437 to 438
if start_time is None:
continue
Copy link
Collaborator

Choose a reason for hiding this comment

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

In what case will the start_time be None? Worth adding a comment for this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I guess there is no specific case where this would happen, so I can remove this logic

Copy link
Collaborator

@Michaelvll Michaelvll left a comment

Choose a reason for hiding this comment

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

Thanks for the quick fix @sumanthgenz! LGTM. Due to the GitHub CI changes, please merge the master branch and push again to enable the PR merge.

@sumanthgenz sumanthgenz force-pushed the sgurram_cost_report_backwards_compatibility branch from 2fcb9e6 to 8269594 Compare February 22, 2023 20:10
@sumanthgenz sumanthgenz merged commit 71697f7 into skypilot-org:master Feb 22, 2023
sumanthgenz added a commit to sumanthgenz/skypilot that referenced this pull request Feb 22, 2023
* handle null usage intervals in duration computing

* pr changes

---------

Co-authored-by: Sumanth <sumanth@MacBook-Pro-5.local>
sumanthgenz added a commit to sumanthgenz/skypilot that referenced this pull request Mar 15, 2023
* handle null usage intervals in duration computing

* pr changes

---------

Co-authored-by: Sumanth <sumanth@MacBook-Pro-5.local>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants