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

Check finished_processing bool instead of status str when polling for completion #61

Closed
wants to merge 3 commits into from

Conversation

KPreisner
Copy link
Member

closes #57

  • pytest succeeds, which confirms the new polling logic is working because it creates circuits and proofs and polls until they are finished processing.
  • sh py_format_code.sh succeeds

self,
circuit_id: str,
) -> str:
def _get_circuit_status(self, circuit_id: str) -> str:
Copy link
Member Author

@KPreisner KPreisner Jan 2, 2025

Choose a reason for hiding this comment

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

The _get_circuit_status and _get_proof_status "private" methods already used the /status API endpoints. However, they did not return the finished_processing value from the response.

Instead of breaking the functionality of these existing methods, I created the _get_circuit_finished_status and _get_proof_finished_status methods, which are now used by the old _get_circuit_status and _get_proof_status methods.

Copy link
Contributor

@grahamu grahamu left a comment

Choose a reason for hiding this comment

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

I'm uncertain what happened here but it seems very strange that _get_circuit_status() and _get_proof_status private methods even exist. Who calls them? Can you remove them? If you remove them can you simplify the "new" method name?

Please refrain from returning mysterious, magic-integer-indexed tuples. Make a class and return that for clarity. Something like:

class OperationStatus:
    def __init__(self, finished: bool, status: str):
        self.finished = finished
        self.status = status

and

    def _get_proof_finished_status(self, proof_id: str) -> OperationStatus:
        ...
        return OperationStatus(finished=finished_processing, status=status)

@grahamu grahamu assigned KPreisner and unassigned grahamu Jan 16, 2025
@KPreisner
Copy link
Member Author

After some Sindri internal conversations, we are holding off on merging this PR in favor of planned refactors of the entire Python SDK.

@KPreisner KPreisner closed this Jan 17, 2025
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.

Update Polling Termination Logic to use finished_processing attribute
2 participants