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

chore(sdk): adding back the required flag for wandb-core #7228

Merged
merged 17 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,9 @@ jobs:

executor: <<parameters.executor>>

environment:
WANDB__REQUIRE_CORE: <<parameters.with_core>>

# Shards the job, setting $CIRCLE_NODE_TOTAL and $CIRCLE_NODE_INDEX.
# https://circleci.com/docs/parallelism-faster-jobs/
parallelism: 2
Expand Down Expand Up @@ -489,6 +492,9 @@ jobs:

executor: <<parameters.executor>>

environment:
WANDB__REQUIRE_CORE: <<parameters.with_core>>

parallelism: 4

steps:
Expand Down Expand Up @@ -624,6 +630,7 @@ jobs:
environment:
SHARD: << parameters.shard >>
COVERAGE_DIR: << parameters.coverage_dir >>
WANDB__REQUIRE_CORE: << parameters.with_core >>
parallelism: << parameters.parallelism >>
resource_class: xlarge
working_directory: /mnt/ramdisk
Expand Down
10 changes: 10 additions & 0 deletions core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@ the package in your environment. The `wandb` library will automatically detect a
pip install -U wandb wandb-core
```

in the top of your script add the following:

```python
import wandb

wandb.require("core")
kptkin marked this conversation as resolved.
Show resolved Hide resolved
```

Note: ensure you have `wandb>=0.16.4`.
kptkin marked this conversation as resolved.
Show resolved Hide resolved

### Platform Compatibility
Expand All @@ -42,6 +50,8 @@ To revert to the old SDK backend, simply uninstall `wandb-core` from your enviro
pip uninstall wandb-core
```

or remove the `wandb.require("core")` from your script.

## Contributing

Your contributions are welcome! Check our [contributing guide](docs/contributing.md) for instructions on setting up your development environment and contributing to the project.
Expand Down
102 changes: 52 additions & 50 deletions core/pkg/service/wandb_settings.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ passenv=
CI_PYTEST_PARALLEL
CI
importer-wandb: WANDB_TEST_SERVER_URL2
WANDB__REQUIRE_CORE
allowlist_externals=
mkdir
nox
Expand Down Expand Up @@ -155,6 +156,7 @@ passenv=
SHARD
WANDB_API_KEY
core: GOCOVERDIR
WANDB__REQUIRE_CORE
allowlist_externals=
mkdir
core: nox
Expand Down Expand Up @@ -186,6 +188,7 @@ passenv=
; llm: WANDB_API_KEY
llm: OPENAI_API_KEY
llm: CO_API_KEY
WANDB__REQUIRE_CORE
allowlist_externals=
mkdir
commands_pre=
Expand All @@ -208,6 +211,7 @@ passenv=
USERNAME
WANDB_API_KEY
SHARD
WANDB__REQUIRE_CORE
deps=
yea-wandb=={env:YEA_WANDB_VERSION}
wheel
Expand Down
5 changes: 5 additions & 0 deletions wandb/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
LAUNCH_QUEUE_NAME = "WANDB_LAUNCH_QUEUE_NAME"
LAUNCH_QUEUE_ENTITY = "WANDB_LAUNCH_QUEUE_ENTITY"
LAUNCH_TRACE_ID = "WANDB_LAUNCH_TRACE_ID"
_REQUIRE_CORE = "WANDB__REQUIRE_CORE"

# For testing, to be removed in future version
USE_V1_ARTIFACTS = "_WANDB_USE_V1_ARTIFACTS"
Expand Down Expand Up @@ -146,6 +147,10 @@ def _env_as_bool(
return val if isinstance(val, bool) else False


def is_require_core(env: Optional[Env] = None) -> bool:
return _env_as_bool(_REQUIRE_CORE, default="False", env=env)


def is_debug(default: Optional[str] = None, env: Optional[Env] = None) -> bool:
return _env_as_bool(DEBUG, default=default, env=env)

Expand Down
Loading
Loading