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 polling and test it #2

Closed
wants to merge 12 commits into from

Conversation

Flix6x
Copy link
Contributor

@Flix6x Flix6x commented Apr 24, 2023

I implemented basic polling. Follow-ups:

Copy link
Collaborator

@victorgarcia98 victorgarcia98 left a comment

Choose a reason for hiding this comment

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

Thanks @Flix6x!

I have only minor change requests and a couple of potential new features:

  • Using the same code to allow to retry the request in case of failiure (up to a maximum number of times.
  • Limiting the polling time. It shouldn't occur, but if a Job becomes "Zombie" and it's not finishing, we just disregard the request. For instance, the polling time limit could be set to a few hours.

src/flexmeasures_client/client.py Outdated Show resolved Hide resolved
src/flexmeasures_client/client.py Outdated Show resolved Hide resolved
src/flexmeasures_client/client.py Outdated Show resolved Hide resolved
src/flexmeasures_client/client.py Outdated Show resolved Hide resolved
Flix6x added 2 commits April 26, 2023 10:26
Signed-off-by: F.N. Claessen <[email protected]>
Signed-off-by: F.N. Claessen <[email protected]>
Copy link
Contributor

@nhoening nhoening left a comment

Choose a reason for hiding this comment

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

Good stuff. I have some ideas about the retrying intervals and, as always, naming.

src/flexmeasures_client/client.py Outdated Show resolved Hide resolved
src/flexmeasures_client/client.py Outdated Show resolved Hide resolved
src/flexmeasures_client/client.py Outdated Show resolved Hide resolved
src/flexmeasures_client/client.py Show resolved Hide resolved
src/flexmeasures_client/client.py Outdated Show resolved Hide resolved
Flix6x added 7 commits April 26, 2023 13:52
Signed-off-by: F.N. Claessen <[email protected]>
Signed-off-by: F.N. Claessen <[email protected]>
Signed-off-by: F.N. Claessen <[email protected]>
Signed-off-by: F.N. Claessen <[email protected]>
Flix6x added 2 commits April 26, 2023 14:29
Signed-off-by: F.N. Claessen <[email protected]>
Signed-off-by: F.N. Claessen <[email protected]>
@Flix6x Flix6x requested a review from victorgarcia98 April 26, 2023 12:34
Copy link
Collaborator

@victorgarcia98 victorgarcia98 left a comment

Choose a reason for hiding this comment

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

Thanks @Flix6x!

I've only small suggestions.

Other than that, I think we could add some validators to the FlexmeasuresClient class, maybe not for this PR:

  • lenght of emai, password and host
  • force scheme to be http or https
  • check if polling_timeout > request_timeout > 0

Somewhat unrelated to this PR, but now that is early and we don't have too much depending on this, I was thinking that we might consider refactoring the class name from FlexmeasuresClient to FlexMeasuresClient.

src/flexmeasures_client/client.py Show resolved Hide resolved
src/flexmeasures_client/client.py Show resolved Hide resolved
src/flexmeasures_client/client.py Show resolved Hide resolved
src/flexmeasures_client/client.py Show resolved Hide resolved
tests/test_client.py Show resolved Hide resolved
tests/test_client.py Show resolved Hide resolved
@Flix6x
Copy link
Contributor Author

Flix6x commented May 8, 2023

Closing this PR, as its contents have been incorporated into #7.

@Flix6x Flix6x closed this May 8, 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

Successfully merging this pull request may close these issues.

4 participants