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 is_running_in_serverless() function #1532

Merged
merged 2 commits into from
Nov 4, 2024
Merged

Add is_running_in_serverless() function #1532

merged 2 commits into from
Nov 4, 2024

Conversation

garrison
Copy link
Member

Summary

This adds a function so that the user can easily detect whether the program is running under Qiskit serverless. In some instances, a person may want to be able to branch on whether that is the case.

Details and comments

I am not necessarily attached to this name.

For the tests, I improved them by making the environment variable handling be temporary and in a fixture. This meant a slight migration to pytest style (from unittest style), and silencing a pylint warning.

@Tansito Tansito requested a review from a team October 30, 2024 12:04
@Tansito
Copy link
Member

Tansito commented Oct 30, 2024

Thank you for this @garrison , I will contact with @pandasa123 to review the naming but this can be very useful definitely!

@pandasa123
Copy link
Collaborator

This looks great. I think the name makes sense

Copy link
Member

@Tansito Tansito left a comment

Choose a reason for hiding this comment

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

@garrison after talking with @pandasa123 in our weekly could we change the name of the method to something more near to what is doing the project right now?

My proposal: is_running_in_serverless()

@garrison
Copy link
Member Author

My proposal: is_running_in_serverless()

I like this even better. Equally clear, less verbose (and fewer underscores).

Updated accordingly in 4ed7f8f.

@garrison garrison changed the title Add is_running_as_serverless_program() function Add is_running_in_serverless() function Oct 31, 2024
@Tansito Tansito self-requested a review November 4, 2024 12:32
Copy link
Member

@Tansito Tansito left a comment

Choose a reason for hiding this comment

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

LGTM, thank you @garrison ! 😄

@Tansito Tansito merged commit 22f6dce into main Nov 4, 2024
10 checks passed
@Tansito Tansito deleted the detect-environment branch November 4, 2024 12:33
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.

3 participants