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

Why metrics['slaviolations'] can only be 1? #10

Closed
Jingbo-leo opened this issue May 27, 2022 · 3 comments
Closed

Why metrics['slaviolations'] can only be 1? #10

Jingbo-leo opened this issue May 27, 2022 · 3 comments

Comments

@Jingbo-leo
Copy link

Thanks a lot for your open source code. I have some doubts. I found that metrics['slaviolations'] = len(np.where([c.destroyAt > c.sla for c in destroyed])) in the stats.py file. No matter how many c.destroyAt > c.sla, this metrics['slaviolations'] can only be 1 each time. Is this correct?Hope to hear from you, thank you very much.

@shreshthtuli
Copy link
Member

Thanks for your interest in our project. np.where gives a list of indices where the input condition is true. Thus, len(np.where([...]) would give us the number of completed tasks in that interval for which the destroy time is higher than the service level agreement.

@Jingbo-leo
Copy link
Author

Jingbo-leo commented May 27, 2022

Thank you very much for your reply. I understand what it means. But writing like this will result in len(np.where([...]) can only be 1 each time, no matter how many c.destroyAt > c.sla. The output of an example is as follows.
destroyed = []
[c.destroyAt > c.sla for c in destroyed] output is: []
np.where([c.destroyAt > c.sla for c in destroyed]) output is: (array([], dtype=int64),)
len(np.where([c.destroyAt > c.sla for c in destroyed])) output is : 1

But, what I understand is, when destroyed = [] , the slaviolations should be 0. So I think there is something wrong with the code. Or is my understanding of slaviolations wrong?

Hope to hear from you.

@shreshthtuli
Copy link
Member

Thanks for raising this. It has been fixed.

brunofaria1322 pushed a commit to brunofaria1322/COSCO that referenced this issue Jun 27, 2023
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

No branches or pull requests

2 participants