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 backend to nums.init. #295

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Add backend to nums.init. #295

wants to merge 2 commits into from

Conversation

elibol
Copy link
Member

@elibol elibol commented Mar 2, 2022

No description provided.

Copy link
Member

@vinamrabenara vinamrabenara left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@bveeramani bveeramani left a comment

Choose a reason for hiding this comment

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

LGTM. Left a minor comment

):
# pylint: disable = import-outside-toplevel
import nums.core.settings as settings

if backend is not None:
assert backend in {"serial", "ray", "dask", "mpi"}
Copy link
Member

Choose a reason for hiding this comment

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

We should raise a ValueError instead of an AssertionError. From the Google style guide:

Do not use assert statements for validating argument values of a public API. assert is used to ensure internal correctness, not to enforce correct usage nor to indicate that some unexpected event occurred.

(We use Black, but this is still applicable)

Copy link
Member

Choose a reason for hiding this comment

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

We should also include a descriptive error message if the users inputs an incorrect value. e.g., f"Expected backend to be one of {BACKEND_NAMES}, but got {backend}."

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