-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(weave): Dry Run Script (#3460)
* Added basic script * Added basic script * Added basic script
- Loading branch information
Showing
3 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# /// script | ||
# requires-python = ">=3.9" | ||
# dependencies = [ | ||
# "weave @ git+https://github.com/wandb/weave.git@master", | ||
# ] | ||
# /// | ||
|
||
# Run this script with `uv run prerelease_dry_run.py` | ||
|
||
import datetime | ||
|
||
import weave | ||
|
||
# This uniq id ensures that the op is not cached | ||
uniq_id = datetime.datetime.now().timestamp() | ||
|
||
|
||
@weave.op | ||
def func(a: int) -> float: | ||
return a + uniq_id | ||
|
||
|
||
def main() -> None: | ||
client = weave.init("test-project") | ||
res = func(42) | ||
|
||
client._flush() | ||
calls = func.calls() | ||
|
||
assert len(calls) == 1 | ||
assert calls[0].output == res | ||
assert calls[0].inputs == {"a": 42} | ||
|
||
|
||
if __name__ == "__main__": | ||
main() | ||
print("Dry run passed") |