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

fix(artifacts): use run project for use_artifact #7701

Merged
merged 2 commits into from
May 24, 2024

Conversation

ibindlish
Copy link
Contributor

@ibindlish ibindlish commented May 24, 2024

Description

  • Fixes WB-NNNNN
  • Fixes #NNNN

Similar to entity envvar issue fixed in #6843

Root Cause:
Run.use_artifact() creates a client and passes the run's entity & project to its settings: code
Api.use_artifact() overrides the entity & project in its settings with values from env variables: code

Repro:
Create a team with 2 users dev-team
Create a restricted project 'testing-use-artifact' and add just user1;
Log artifact dev-team/testing-use-artifact/artifact:v0

Log in as user2 from dev-team

Run the following code as user2:

os.environ["WANDB_PROJECT"] = "testing-use-artifact"

ENTITY = "dev-team"
PROJECT = "testing"
ARTIFACT = "artifact"

run = wandb.init(entity=ENTITY, project=PROJECT)
artifact = run.use_artifact("dev-team/testing/artifact:v0")
print(artifact.id)
run.finish()

Before:

wandb: ERROR Error while calling W&B API: failed to find run testing-use-artifact/tbwmxqpl (<Response [404]>)
wandb: ERROR Permission denied to access dev-team/testing/tbwmxqpl

After: No error.

  • I updated CHANGELOG.md, or it's not applicable

Testing

How was this PR tested?

Copy link

codecov bot commented May 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.85%. Comparing base (6bc85c2) to head (ec88f7e).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #7701      +/-   ##
==========================================
+ Coverage   72.81%   75.85%   +3.03%     
==========================================
  Files         491      500       +9     
  Lines       55565    54179    -1386     
==========================================
+ Hits        40462    41096     +634     
+ Misses      14681    12670    -2011     
+ Partials      422      413       -9     
Flag Coverage Δ
func 41.34% <ø> (+0.02%) ⬆️
system 63.52% <ø> (+0.01%) ⬆️
unit 56.31% <ø> (+5.39%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
wandb/sdk/wandb_run.py 88.46% <ø> (ø)

... and 116 files with indirect coverage changes

@ibindlish ibindlish marked this pull request as ready for review May 24, 2024 18:40
@ibindlish ibindlish requested a review from a team as a code owner May 24, 2024 18:40
@ibindlish ibindlish merged commit 93bc008 into main May 24, 2024
48 checks passed
@ibindlish ibindlish deleted the ibindlish/artifacts/run-project-override-use-artifact branch May 24, 2024 19:20
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.

2 participants