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

add top to job requests api #4326

Merged
merged 11 commits into from
Mar 6, 2023
Merged

add top to job requests api #4326

merged 11 commits into from
Mar 6, 2023

Conversation

shayki5
Copy link
Contributor

@shayki5 shayki5 commented Mar 6, 2023

Provide a description of what has been changed

Checklist

Fixes #4324

shayki5 added 3 commits March 6, 2023 11:08
Signed-off-by: Shayki Abramczyk <shayki5@gmail.com>
Signed-off-by: Shayki Abramczyk <shayki5@gmail.com>
Signed-off-by: Shayki Abramczyk <shayki5@gmail.com>
@shayki5 shayki5 requested a review from a team as a code owner March 6, 2023 10:02
@JorTurFer
Copy link
Member

Hi @shayki5
I ❤️ this improvement!
Should we allow users to set their own values for the top (keeping 250 or whatever as default)? I mean, end-users can increase the timeout using env vars and maybe there are some user cases in really large orgs where 250 isn't enough, maybe giving the option to set the top value (in addition to the already existing option for increasing the timeout) would fulfil that requirement.
WDYT?

@shayki5
Copy link
Contributor Author

shayki5 commented Mar 6, 2023

Hi @JorTurFer, thank you for your quick response!
Yea, it's a good idea, it could be a variable, I just need to check how to do it...
I thought 250 it's enough because need more than 250 waiting jobs in one pool for the scale not to work properly, but as you said, maybe in large orgs it's should be the case.

Copy link
Member

@zroubalik zroubalik left a comment

Choose a reason for hiding this comment

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

I agree with @JorTurFer, we should add a property for this :) Thanks for the contribution!

Signed-off-by: Shayki Abramczyk <shayki5@gmail.com>
@shayki5
Copy link
Contributor Author

shayki5 commented Mar 6, 2023

@zroubalik @JorTurFer I'm not familiar with go but I tried to add it as a parameter, can you review please? thank you!

Copy link
Member

@JorTurFer JorTurFer left a comment

Choose a reason for hiding this comment

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

Looking good! Could you add this new field to the parsing tests?
As we are adding a new parameter, a PR to docs is also required explaining the new parameter. This is the file you need to edit https://github.com/kedacore/keda-docs/blob/main/content/docs/2.10/scalers/azure-pipelines.md

pkg/scalers/azure_pipelines_scaler.go Outdated Show resolved Hide resolved
Co-authored-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es>
Signed-off-by: Shayki Abramczyk <shayki5@gmail.com>
@shayki5
Copy link
Contributor Author

shayki5 commented Mar 6, 2023

@JorTurFer Sure, thank you so much for the parsing test, I added it.
I opened a PR for the docs: kedacore/keda-docs#1082

Signed-off-by: Shayki Abramczyk <shayki5@gmail.com>
@JorTurFer
Copy link
Member

Sure, thank you so much for the parsing test, I added it.

I didn't add the parsing test, I just suggested a change in the code to follow the sytle xD You still need to add a case here https://github.com/kedacore/keda/blob/main/pkg/scalers/azure_pipelines_scaler_test.go#L26

Signed-off-by: Shayki Abramczyk <shayki.abramczyk@tipalti.com>
@shayki5
Copy link
Contributor Author

shayki5 commented Mar 6, 2023

Sure, thank you so much for the parsing test, I added it.

I didn't add the parsing test, I just suggested a change in the code to follow the sytle xD You still need to add a case here https://github.com/kedacore/keda/blob/main/pkg/scalers/azure_pipelines_scaler_test.go#L26

Oh sorry, my bad, this is what happens that today is the first day for you to write go ;) I just followed the demands syntax...
Which test should I add? I see the testAzurePipelinesMetadata checks if there are empty values but in this case the jobsToFetch it's optional, it can be empty.

@JorTurFer
Copy link
Member

JorTurFer commented Mar 6, 2023

Which test should I add?

I think that we should cover 3 cases, empty (already covered xD), correctly provided and incorrectly provided. I mean, in case of empty we don't have anything to test, but we should test that if a correct value is set we don't raise any error and in case of wrong value set, we raise an error.
This can be done just adding the new 2 cases to the array

@shayki5
Copy link
Contributor Author

shayki5 commented Mar 6, 2023

Which test should I add?

I think that we should cover 3 cases, empty (already covered xD), correctly provided and incorrectly provided. I mean, in case of empty we don't have anything to test, but we should test that if a correct value is set we don't raise any error and in case of wrong value set, we raise an error. This can be done just adding the new 2 cases to the array

I understand, I tried to look in the existing tests but couldn't figure out how can I implement those tests :(

@JorTurFer
Copy link
Member

JorTurFer commented Mar 6, 2023

You can check how this case (activationTargetPipelinesQueueLength malformed) is added: https://github.com/kedacore/keda/blob/main/pkg/scalers/azure_pipelines_scaler_test.go#L41-L42

Basically, you need to provide the scaler values (you can take this line as base) including the new parameter, in one case wrongly (for example, setting "a" instead of a number) and other case correctly. If you check the line options, there is a boolean to specify if the case should raise an error or not. The wrong case should have true in that field because it should raise an error, the correct case should have false because not error should be raised

Signed-off-by: Shayki Abramczyk <shayki.abramczyk@tipalti.com>
@shayki5
Copy link
Contributor Author

shayki5 commented Mar 6, 2023

You can check how this case (activationTargetPipelinesQueueLength malformed) is added: https://github.com/kedacore/keda/blob/main/pkg/scalers/azure_pipelines_scaler_test.go#L41-L42

Basically, you need to provide the scaler values (you can take this line as base) including the new parameter, in one case wrongly (for example, setting "a" instead of a number) and other case correctly. If you check the line options, there is a boolean to specify if the case should raise an error or not. The wrong case should have true in that field because it should raise an error, the correct case should have false because not error should be raised

Thank you so much for your explanation! I added something, can you check..?

@JorTurFer
Copy link
Member

JorTurFer commented Mar 6, 2023

/run-e2e pipeline*
Update: You can check the progress here

CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Member

@JorTurFer JorTurFer left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for the improvement.
Please update the changelog (The comment I wrote) and also the test (the malformed case should raise an error, that's why the boolean has to be true)

shayki5 and others added 2 commits March 6, 2023 16:02
Co-authored-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es>
Signed-off-by: Shayki Abramczyk <shayki5@gmail.com>
Co-authored-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es>
Signed-off-by: Shayki Abramczyk <shayki5@gmail.com>
Co-authored-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es>
Signed-off-by: Shayki Abramczyk <shayki5@gmail.com>
@shayki5
Copy link
Contributor Author

shayki5 commented Mar 6, 2023

Fixed :) thank you so much!!

@JorTurFer
Copy link
Member

JorTurFer commented Mar 6, 2023

/run-e2e pipeline*
Update: You can check the progress here

@JorTurFer JorTurFer merged commit 256e913 into kedacore:main Mar 6, 2023
@JorTurFer
Copy link
Member

Thanks for the contribution!
This feature will be released as part of v2.10

@shayki5
Copy link
Contributor Author

shayki5 commented Mar 6, 2023

Your prompt response and coordination are greatly appreciated!
Do you know when v2.10 will be released?

@JorTurFer
Copy link
Member

Do you know when v2.10 will be released?

Most probably this week

xoanmm pushed a commit to xoanmm/keda that referenced this pull request Mar 22, 2023
Co-authored-by: Jorge Turrado Ferrero <Jorge_turrado@hotmail.es>
Co-authored-by: Shayki Abramczyk <shayki.abramczyk@tipalti.com>
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.

Azure Pipelines trigger failing with "Client.Timeout exceeded while awaiting headers"
3 participants