-
Notifications
You must be signed in to change notification settings - Fork 235
Recalc subscriptions #1380
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
Recalc subscriptions #1380
Conversation
This function is responsible calculate subscription usage for each show and it's previous version had a bug that could lead to negative values.
ramonfigueiredo
left a comment
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.
Thanks, @DiegoTavares
Approved!
| -- | ||
| -- concatenates all tags in host_tag and sets host.str_tags | ||
| -- | ||
| UPDATE subscription SET int_cores = 0; |
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.
Please include:
UPDATE subscription SET int_gpus = 0;
| -- concatenates all tags in host_tag and sets host.str_tags | ||
| -- | ||
| UPDATE subscription SET int_cores = 0; | ||
| FOR r IN (select show.str_name as show_name, proc.pk_show, alloc.pk_alloc, alloc.str_name as alloc_name, sum(proc.int_cores_reserved) as c |
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.
Please include sum(proc.int_gpus_reserved) as d after sum(proc.int_cores_reserved) as c,:
sum(proc.int_cores_reserved) as c,
sum(proc.int_gpus_reserved) as d
| BEGIN | ||
| SELECT int_burst INTO cur_burst FROM subscription WHERE pk_alloc=r.pk_alloc AND pk_show=r.pk_show; | ||
| -- Also changing int_burst here to bypass VERIFY_SUBSCRIPTION trigger | ||
| UPDATE subscription SET int_cores = r.c, int_burst = r.c WHERE pk_alloc=r.pk_alloc AND pk_show=r.pk_show; |
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.
Missing int_burst = r.c:
int_burst = r.c, int_gpus = r.d
Add recalculateSubscriptions() method to MaintenanceDao interface and its implementation in MaintenanceDaoJdbc. This method calls the recalculate_subs() PostgreSQL function that was added in PR AcademySoftwareFoundation#1380. Part of AcademySoftwareFoundation#1562 Signed-off-by: pmady <[email protected]>
Add recalculateSubscriptions() method to MaintenanceDao interface and its implementation in MaintenanceDaoJdbc. This method calls the recalculate_subs() PostgreSQL function that was added in PR AcademySoftwareFoundation#1380. Part of AcademySoftwareFoundation#1562 Signed-off-by: pmady <[email protected]>
This function is responsible calculate subscription usage for each show and it's previous version had a bug that could lead to negative values.