id int64 1 6.07M | name stringlengths 1 295 | code stringlengths 12 426k | language stringclasses 1
value | source_file stringlengths 5 202 | start_line int64 1 158k | end_line int64 1 158k | repo dict |
|---|---|---|---|---|---|---|---|
1,401 | create_project | def create_project(self, name: str, entity: str):
self.client.execute(self.CREATE_PROJECT, {"entityName": entity, "name": name}) | python | wandb/apis/public.py | 462 | 463 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,402 | load_report | def load_report(self, path: str) -> "wandb.apis.reports.Report":
"""Get report at a given path.
Arguments:
path: (str) Path to the target report in the form `entity/project/reports/reportId`.
You can get this by copy-pasting the URL after your wandb url. For example:
`megatruong/report-editing/reports/My-fabulous-report-title--VmlldzoxOTc1Njk0`
Returns:
A `BetaReport` object which represents the report at `path`
Raises:
wandb.Error if path is invalid
"""
return wandb.apis.reports.Report.from_url(path) | python | wandb/apis/public.py | 465 | 479 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,403 | create_user | def create_user(self, email, admin=False):
"""Create a new user.
Arguments:
email: (str) The name of the team
admin: (bool) Whether this user should be a global instance admin
Returns:
A `User` object
"""
return User.create(self, email, admin) | python | wandb/apis/public.py | 481 | 491 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,404 | sync_tensorboard | def sync_tensorboard(self, root_dir, run_id=None, project=None, entity=None):
"""Sync a local directory containing tfevent files to wandb."""
from wandb.sync import SyncManager # TODO: circular import madness
run_id = run_id or runid.generate_id()
project = project or self.settings.get("project") or "uncategorized"
entity = entity or self.default_entity
# TODO: pipe through log_path to inform the user how to debug
sm = SyncManager(
project=project,
entity=entity,
run_id=run_id,
mark_synced=False,
app_url=self.client.app_url,
view=False,
verbose=False,
sync_tensorboard=True,
)
sm.add(root_dir)
sm.start()
while not sm.is_done():
_ = sm.poll()
return self.run("/".join([entity, project, run_id])) | python | wandb/apis/public.py | 493 | 515 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,405 | client | def client(self):
return self._client | python | wandb/apis/public.py | 518 | 519 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,406 | user_agent | def user_agent(self):
return "W&B Public Client %s" % __version__ | python | wandb/apis/public.py | 522 | 523 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,407 | api_key | def api_key(self):
if self._api_key is not None:
return self._api_key
auth = requests.utils.get_netrc_auth(self.settings["base_url"])
key = None
if auth:
key = auth[-1]
# Environment should take precedence
if os.getenv("WANDB_API_KEY"):
key = os.environ["WANDB_API_KEY"]
self._api_key = key # memoize key
return key | python | wandb/apis/public.py | 526 | 537 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,408 | default_entity | def default_entity(self):
if self._default_entity is None:
res = self._client.execute(self.VIEWER_QUERY)
self._default_entity = (res.get("viewer") or {}).get("entity")
return self._default_entity | python | wandb/apis/public.py | 540 | 544 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,409 | viewer | def viewer(self):
if self._viewer is None:
self._viewer = User(
self._client, self._client.execute(self.VIEWER_QUERY).get("viewer")
)
self._default_entity = self._viewer.entity
return self._viewer | python | wandb/apis/public.py | 547 | 553 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,410 | flush | def flush(self):
"""Flush the local cache.
The api object keeps a local cache of runs, so if the state of the run may
change while executing your script you must clear the local cache with
`api.flush()` to get the latest values associated with the run.
"""
self._runs = {} | python | wandb/apis/public.py | 555 | 562 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,411 | from_path | def from_path(self, path):
"""Return a run, sweep, project or report from a path.
Examples:
```
project = api.from_path("my_project")
team_project = api.from_path("my_team/my_project")
run = api.from_path("my_team/my_project/runs/id")
sweep = api.from_path("my_team/my_project/sweeps/id")
report = api.from_path("my_team/my_project/reports/My-Report-Vm11dsdf")
```
Arguments:
path: (str) The path to the project, run, sweep or report
Returns:
A `Project`, `Run`, `Sweep`, or `BetaReport` instance.
Raises:
wandb.Error if path is invalid or the object doesn't exist
"""
parts = path.strip("/ ").split("/")
if len(parts) == 1:
return self.project(path)
elif len(parts) == 2:
return self.project(parts[1], parts[0])
elif len(parts) == 3:
return self.run(path)
elif len(parts) == 4:
if parts[2].startswith("run"):
return self.run(path)
elif parts[2].startswith("sweep"):
return self.sweep(path)
elif parts[2].startswith("report"):
if "--" not in parts[-1]:
if "-" in parts[-1]:
raise wandb.Error(
"Invalid report path, should be team/project/reports/Name--XXXX"
)
else:
parts[-1] = "--" + parts[-1]
name, id = parts[-1].split("--")
return BetaReport(
self.client,
{
"display_name": urllib.parse.unquote(name.replace("-", " ")),
"id": id,
"spec": "{}",
},
parts[0],
parts[1],
)
raise wandb.Error(
"Invalid path, should be TEAM/PROJECT/TYPE/ID where TYPE is runs, sweeps, or reports"
) | python | wandb/apis/public.py | 564 | 618 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,412 | _parse_project_path | def _parse_project_path(self, path):
"""Return project and entity for project specified by path."""
project = self.settings["project"]
entity = self.settings["entity"] or self.default_entity
if path is None:
return entity, project
parts = path.split("/", 1)
if len(parts) == 1:
return entity, path
return parts | python | wandb/apis/public.py | 620 | 629 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,413 | _parse_path | def _parse_path(self, path):
"""Parse url, filepath, or docker paths.
Allows paths in the following formats:
- url: entity/project/runs/id
- path: entity/project/id
- docker: entity/project:id
Entity is optional and will fall back to the current logged-in user.
"""
project = self.settings["project"]
entity = self.settings["entity"] or self.default_entity
parts = (
path.replace("/runs/", "/").replace("/sweeps/", "/").strip("/ ").split("/")
)
if ":" in parts[-1]:
id = parts[-1].split(":")[-1]
parts[-1] = parts[-1].split(":")[0]
elif parts[-1]:
id = parts[-1]
if len(parts) > 1:
project = parts[1]
if entity and id == project:
project = parts[0]
else:
entity = parts[0]
if len(parts) == 3:
entity = parts[0]
else:
project = parts[0]
return entity, project, id | python | wandb/apis/public.py | 631 | 661 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,414 | _parse_artifact_path | def _parse_artifact_path(self, path):
"""Return project, entity and artifact name for project specified by path."""
project = self.settings["project"]
entity = self.settings["entity"] or self.default_entity
if path is None:
return entity, project
parts = path.split("/")
if len(parts) > 3:
raise ValueError("Invalid artifact path: %s" % path)
elif len(parts) == 1:
return entity, project, path
elif len(parts) == 2:
return entity, parts[0], parts[1]
return parts | python | wandb/apis/public.py | 663 | 676 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,415 | projects | def projects(self, entity=None, per_page=200):
"""Get projects for a given entity.
Arguments:
entity: (str) Name of the entity requested. If None, will fall back to
default entity passed to `Api`. If no default entity, will raise a `ValueError`.
per_page: (int) Sets the page size for query pagination. None will use the default size.
Usually there is no reason to change this.
Returns:
A `Projects` object which is an iterable collection of `Project` objects.
"""
if entity is None:
entity = self.settings["entity"] or self.default_entity
if entity is None:
raise ValueError(
"entity must be passed as a parameter, or set in settings"
)
if entity not in self._projects:
self._projects[entity] = Projects(self.client, entity, per_page=per_page)
return self._projects[entity] | python | wandb/apis/public.py | 678 | 699 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,416 | project | def project(self, name, entity=None):
if entity is None:
entity = self.settings["entity"] or self.default_entity
return Project(self.client, entity, name, {}) | python | wandb/apis/public.py | 701 | 704 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,417 | reports | def reports(self, path="", name=None, per_page=50):
"""Get reports for a given project path.
WARNING: This api is in beta and will likely change in a future release
Arguments:
path: (str) path to project the report resides in, should be in the form: "entity/project"
name: (str) optional name of the report requested.
per_page: (int) Sets the page size for query pagination. None will use the default size.
Usually there is no reason to change this.
Returns:
A `Reports` object which is an iterable collection of `BetaReport` objects.
"""
entity, project, _ = self._parse_path(path + "/fake_run")
if name:
name = urllib.parse.unquote(name)
key = "/".join([entity, project, str(name)])
else:
key = "/".join([entity, project])
if key not in self._reports:
self._reports[key] = Reports(
self.client,
Project(self.client, entity, project, {}),
name=name,
per_page=per_page,
)
return self._reports[key] | python | wandb/apis/public.py | 706 | 735 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,418 | create_team | def create_team(self, team, admin_username=None):
"""Create a new team.
Arguments:
team: (str) The name of the team
admin_username: (str) optional username of the admin user of the team, defaults to the current user.
Returns:
A `Team` object
"""
return Team.create(self, team, admin_username) | python | wandb/apis/public.py | 737 | 747 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,419 | team | def team(self, team):
return Team(self.client, team) | python | wandb/apis/public.py | 749 | 750 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,420 | user | def user(self, username_or_email):
"""Return a user from a username or email address.
Note: This function only works for Local Admins, if you are trying to get your own user object, please use `api.viewer`.
Arguments:
username_or_email: (str) The username or email address of the user
Returns:
A `User` object or None if a user couldn't be found
"""
res = self._client.execute(self.USERS_QUERY, {"query": username_or_email})
if len(res["users"]["edges"]) == 0:
return None
elif len(res["users"]["edges"]) > 1:
wandb.termwarn(
"Found multiple users, returning the first user matching {}".format(
username_or_email
)
)
return User(self._client, res["users"]["edges"][0]["node"]) | python | wandb/apis/public.py | 752 | 772 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,421 | users | def users(self, username_or_email):
"""Return all users from a partial username or email address query.
Note: This function only works for Local Admins, if you are trying to get your own user object, please use `api.viewer`.
Arguments:
username_or_email: (str) The prefix or suffix of the user you want to find
Returns:
An array of `User` objects
"""
res = self._client.execute(self.USERS_QUERY, {"query": username_or_email})
return [User(self._client, edge["node"]) for edge in res["users"]["edges"]] | python | wandb/apis/public.py | 774 | 786 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,422 | runs | def runs(
self,
path: Optional[str] = None,
filters: Optional[Dict[str, Any]] = None,
order: str = "-created_at",
per_page: int = 50,
include_sweeps: bool = True,
):
"""Return a set of runs from a project that match the filters provided.
You can filter by `config.*`, `summary_metrics.*`, `tags`, `state`, `entity`, `createdAt`, etc.
Examples:
Find runs in my_project where config.experiment_name has been set to "foo"
```
api.runs(path="my_entity/my_project", filters={"config.experiment_name": "foo"})
```
Find runs in my_project where config.experiment_name has been set to "foo" or "bar"
```
api.runs(
path="my_entity/my_project",
filters={"$or": [{"config.experiment_name": "foo"}, {"config.experiment_name": "bar"}]}
)
```
Find runs in my_project where config.experiment_name matches a regex (anchors are not supported)
```
api.runs(
path="my_entity/my_project",
filters={"config.experiment_name": {"$regex": "b.*"}}
)
```
Find runs in my_project where the run name matches a regex (anchors are not supported)
```
api.runs(
path="my_entity/my_project",
filters={"display_name": {"$regex": "^foo.*"}}
)
```
Find runs in my_project sorted by ascending loss
```
api.runs(path="my_entity/my_project", order="+summary_metrics.loss")
```
Arguments:
path: (str) path to project, should be in the form: "entity/project"
filters: (dict) queries for specific runs using the MongoDB query language.
You can filter by run properties such as config.key, summary_metrics.key, state, entity, createdAt, etc.
For example: {"config.experiment_name": "foo"} would find runs with a config entry
of experiment name set to "foo"
You can compose operations to make more complicated queries,
see Reference for the language is at https://docs.mongodb.com/manual/reference/operator/query
order: (str) Order can be `created_at`, `heartbeat_at`, `config.*.value`, or `summary_metrics.*`.
If you prepend order with a + order is ascending.
If you prepend order with a - order is descending (default).
The default order is run.created_at from newest to oldest.
Returns:
A `Runs` object, which is an iterable collection of `Run` objects.
"""
entity, project = self._parse_project_path(path)
filters = filters or {}
key = (path or "") + str(filters) + str(order)
if not self._runs.get(key):
self._runs[key] = Runs(
self.client,
entity,
project,
filters=filters,
order=order,
per_page=per_page,
include_sweeps=include_sweeps,
)
return self._runs[key] | python | wandb/apis/public.py | 788 | 864 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,423 | run | def run(self, path=""):
"""Return a single run by parsing path in the form entity/project/run_id.
Arguments:
path: (str) path to run in the form `entity/project/run_id`.
If `api.entity` is set, this can be in the form `project/run_id`
and if `api.project` is set this can just be the run_id.
Returns:
A `Run` object.
"""
entity, project, run_id = self._parse_path(path)
if not self._runs.get(path):
self._runs[path] = Run(self.client, entity, project, run_id)
return self._runs[path] | python | wandb/apis/public.py | 867 | 881 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,424 | queued_run | def queued_run(
self,
entity,
project,
queue_name,
run_queue_item_id,
container_job=False,
project_queue=None,
):
"""Return a single queued run based on the path.
Parses paths of the form entity/project/queue_id/run_queue_item_id.
"""
return QueuedRun(
self.client,
entity,
project,
queue_name,
run_queue_item_id,
container_job=container_job,
project_queue=project_queue,
) | python | wandb/apis/public.py | 883 | 904 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,425 | sweep | def sweep(self, path=""):
"""Return a sweep by parsing path in the form `entity/project/sweep_id`.
Arguments:
path: (str, optional) path to sweep in the form entity/project/sweep_id. If `api.entity`
is set, this can be in the form project/sweep_id and if `api.project` is set
this can just be the sweep_id.
Returns:
A `Sweep` object.
"""
entity, project, sweep_id = self._parse_path(path)
if not self._sweeps.get(path):
self._sweeps[path] = Sweep(self.client, entity, project, sweep_id)
return self._sweeps[path] | python | wandb/apis/public.py | 907 | 921 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,426 | artifact_types | def artifact_types(self, project=None):
entity, project = self._parse_project_path(project)
return ProjectArtifactTypes(self.client, entity, project) | python | wandb/apis/public.py | 924 | 926 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,427 | artifact_type | def artifact_type(self, type_name, project=None):
entity, project = self._parse_project_path(project)
return ArtifactType(self.client, entity, project, type_name) | python | wandb/apis/public.py | 929 | 931 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,428 | artifact_versions | def artifact_versions(self, type_name, name, per_page=50):
entity, project, collection_name = self._parse_artifact_path(name)
artifact_type = ArtifactType(self.client, entity, project, type_name)
return artifact_type.collection(collection_name).versions(per_page=per_page) | python | wandb/apis/public.py | 934 | 937 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,429 | artifact | def artifact(self, name, type=None):
"""Return a single artifact by parsing path in the form `entity/project/run_id`.
Arguments:
name: (str) An artifact name. May be prefixed with entity/project. Valid names
can be in the following forms:
name:version
name:alias
digest
type: (str, optional) The type of artifact to fetch.
Returns:
A `Artifact` object.
"""
if name is None:
raise ValueError("You must specify name= to fetch an artifact.")
entity, project, artifact_name = self._parse_artifact_path(name)
artifact = Artifact(self.client, entity, project, artifact_name)
if type is not None and artifact.type != type:
raise ValueError(
f"type {type} specified but this artifact is of type {artifact.type}"
)
return artifact | python | wandb/apis/public.py | 940 | 962 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,430 | job | def job(self, name, path=None):
if name is None:
raise ValueError("You must specify name= to fetch a job.")
return Job(self, name, path) | python | wandb/apis/public.py | 965 | 968 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,431 | __init__ | def __init__(self, attrs: MutableMapping[str, Any]):
self._attrs = attrs | python | wandb/apis/public.py | 972 | 973 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,432 | snake_to_camel | def snake_to_camel(self, string):
camel = "".join([i.title() for i in string.split("_")])
return camel[0].lower() + camel[1:] | python | wandb/apis/public.py | 975 | 977 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,433 | display | def display(self, height=420, hidden=False) -> bool:
"""Display this object in jupyter."""
html = self.to_html(height, hidden)
if html is None:
wandb.termwarn("This object does not support `.display()`")
return False
if ipython.in_jupyter():
ipython.display_html(html)
return True
else:
wandb.termwarn(".display() only works in jupyter environments")
return False | python | wandb/apis/public.py | 979 | 990 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,434 | to_html | def to_html(self, *args, **kwargs):
return None | python | wandb/apis/public.py | 992 | 993 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,435 | __getattr__ | def __getattr__(self, name):
key = self.snake_to_camel(name)
if key == "user":
raise AttributeError
if key in self._attrs.keys():
return self._attrs[key]
elif name in self._attrs.keys():
return self._attrs[name]
else:
raise AttributeError(f"{repr(self)!r} object has no attribute {name!r}") | python | wandb/apis/public.py | 995 | 1,004 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,436 | __init__ | def __init__(
self,
client: Client,
variables: MutableMapping[str, Any],
per_page: Optional[int] = None,
):
self.client = client
self.variables = variables
# We don't allow unbounded paging
self.per_page = per_page
if self.per_page is None:
self.per_page = 50
self.objects = []
self.index = -1
self.last_response = None | python | wandb/apis/public.py | 1,010 | 1,024 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,437 | __iter__ | def __iter__(self):
self.index = -1
return self | python | wandb/apis/public.py | 1,026 | 1,028 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,438 | __len__ | def __len__(self):
if self.length is None:
self._load_page()
if self.length is None:
raise ValueError("Object doesn't provide length")
return self.length | python | wandb/apis/public.py | 1,030 | 1,035 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,439 | length | def length(self):
raise NotImplementedError | python | wandb/apis/public.py | 1,038 | 1,039 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,440 | more | def more(self):
raise NotImplementedError | python | wandb/apis/public.py | 1,042 | 1,043 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,441 | cursor | def cursor(self):
raise NotImplementedError | python | wandb/apis/public.py | 1,046 | 1,047 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,442 | convert_objects | def convert_objects(self):
raise NotImplementedError | python | wandb/apis/public.py | 1,049 | 1,050 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,443 | update_variables | def update_variables(self):
self.variables.update({"perPage": self.per_page, "cursor": self.cursor}) | python | wandb/apis/public.py | 1,052 | 1,053 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,444 | _load_page | def _load_page(self):
if not self.more:
return False
self.update_variables()
self.last_response = self.client.execute(
self.QUERY, variable_values=self.variables
)
self.objects.extend(self.convert_objects())
return True | python | wandb/apis/public.py | 1,055 | 1,063 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,445 | __getitem__ | def __getitem__(self, index):
loaded = True
stop = index.stop if isinstance(index, slice) else index
while loaded and stop > len(self.objects) - 1:
loaded = self._load_page()
return self.objects[index] | python | wandb/apis/public.py | 1,065 | 1,070 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,446 | __next__ | def __next__(self):
self.index += 1
if len(self.objects) <= self.index:
if not self._load_page():
raise StopIteration
if len(self.objects) <= self.index:
raise StopIteration
return self.objects[self.index] | python | wandb/apis/public.py | 1,072 | 1,079 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,447 | __init__ | def __init__(self, client, attrs):
super().__init__(attrs)
self._client = client
self._user_api = None | python | wandb/apis/public.py | 1,123 | 1,126 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,448 | user_api | def user_api(self):
"""An instance of the api using credentials from the user."""
if self._user_api is None and len(self.api_keys) > 0:
self._user_api = wandb.Api(api_key=self.api_keys[0])
return self._user_api | python | wandb/apis/public.py | 1,129 | 1,133 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,449 | create | def create(cls, api, email, admin=False):
"""Create a new user.
Arguments:
api: (`Api`) The api instance to use
email: (str) The name of the team
admin: (bool) Whether this user should be a global instance admin
Returns:
A `User` object
"""
res = api.client.execute(
cls.CREATE_USER_MUTATION,
{"email": email, "admin": admin},
)
return User(api.client, res["createUser"]["user"]) | python | wandb/apis/public.py | 1,136 | 1,151 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,450 | api_keys | def api_keys(self):
if self._attrs.get("apiKeys") is None:
return []
return [k["node"]["name"] for k in self._attrs["apiKeys"]["edges"]] | python | wandb/apis/public.py | 1,154 | 1,157 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,451 | teams | def teams(self):
if self._attrs.get("teams") is None:
return []
return [k["node"]["name"] for k in self._attrs["teams"]["edges"]] | python | wandb/apis/public.py | 1,160 | 1,163 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,452 | delete_api_key | def delete_api_key(self, api_key):
"""Delete a user's api key.
Returns:
Boolean indicating success
Raises:
ValueError if the api_key couldn't be found
"""
idx = self.api_keys.index(api_key)
try:
self._client.execute(
self.DELETE_API_KEY_MUTATION,
{"id": self._attrs["apiKeys"]["edges"][idx]["node"]["id"]},
)
except requests.exceptions.HTTPError:
return False
return True | python | wandb/apis/public.py | 1,165 | 1,182 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,453 | generate_api_key | def generate_api_key(self, description=None):
"""Generate a new api key.
Returns:
The new api key, or None on failure
"""
try:
# We must make this call using credentials from the original user
key = self.user_api.client.execute(
self.GENERATE_API_KEY_MUTATION, {"description": description}
)["generateApiKey"]["apiKey"]
self._attrs["apiKeys"]["edges"].append({"node": key})
return key["name"]
except (requests.exceptions.HTTPError, AttributeError):
return None | python | wandb/apis/public.py | 1,184 | 1,198 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,454 | __repr__ | def __repr__(self):
if "email" in self._attrs:
return f"<User {self._attrs['email']}>"
elif "username" in self._attrs:
return f"<User {self._attrs['username']}>"
elif "id" in self._attrs:
return f"<User {self._attrs['id']}>"
elif "name" in self._attrs:
return f"<User {self._attrs['name']!r}>"
else:
return "<User ???>" | python | wandb/apis/public.py | 1,200 | 1,210 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,455 | __init__ | def __init__(self, client, team, attrs):
super().__init__(attrs)
self._client = client
self.team = team | python | wandb/apis/public.py | 1,224 | 1,227 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,456 | delete | def delete(self):
"""Remove a member from a team.
Returns:
Boolean indicating success
"""
try:
return self._client.execute(
self.DELETE_MEMBER_MUTATION, {"id": self.id, "entityName": self.team}
)["deleteInvite"]["success"]
except requests.exceptions.HTTPError:
return False | python | wandb/apis/public.py | 1,229 | 1,240 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,457 | __repr__ | def __repr__(self):
return f"<Member {self.name} ({self.account_type})>" | python | wandb/apis/public.py | 1,242 | 1,243 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,458 | __init__ | def __init__(self, client, name, attrs=None):
super().__init__(attrs or {})
self._client = client
self.name = name
self.load() | python | wandb/apis/public.py | 1,324 | 1,328 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,459 | create | def create(cls, api, team, admin_username=None):
"""Create a new team.
Arguments:
api: (`Api`) The api instance to use
team: (str) The name of the team
admin_username: (str) optional username of the admin user of the team, defaults to the current user.
Returns:
A `Team` object
"""
try:
api.client.execute(
cls.CREATE_TEAM_MUTATION,
{"teamName": team, "teamAdminUserName": admin_username},
)
except requests.exceptions.HTTPError:
pass
return Team(api.client, team) | python | wandb/apis/public.py | 1,331 | 1,349 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,460 | invite | def invite(self, username_or_email, admin=False):
"""Invite a user to a team.
Arguments:
username_or_email: (str) The username or email address of the user you want to invite
admin: (bool) Whether to make this user a team admin, defaults to False
Returns:
True on success, False if user was already invited or didn't exist
"""
variables = {"entityName": self.name, "admin": admin}
if "@" in username_or_email:
variables["email"] = username_or_email
else:
variables["username"] = username_or_email
try:
self._client.execute(self.CREATE_INVITE_MUTATION, variables)
except requests.exceptions.HTTPError:
return False
return True | python | wandb/apis/public.py | 1,351 | 1,370 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,461 | create_service_account | def create_service_account(self, description):
"""Create a service account for the team.
Arguments:
description: (str) A description for this service account
Returns:
The service account `Member` object, or None on failure
"""
try:
self._client.execute(
self.CREATE_SERVICE_ACCOUNT_MUTATION,
{"description": description, "entityName": self.name},
)
self.load(True)
return self.members[-1]
except requests.exceptions.HTTPError:
return None | python | wandb/apis/public.py | 1,372 | 1,389 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,462 | load | def load(self, force=False):
if force or not self._attrs:
response = self._client.execute(self.TEAM_QUERY, {"name": self.name})
self._attrs = response["entity"]
self._attrs["members"] = [
Member(self._client, self.name, member)
for member in self._attrs["members"]
]
return self._attrs | python | wandb/apis/public.py | 1,391 | 1,399 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,463 | __repr__ | def __repr__(self):
return f"<Team {self.name}>" | python | wandb/apis/public.py | 1,401 | 1,402 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,464 | __init__ | def __init__(self, client, entity, per_page=50):
self.client = client
self.entity = entity
variables = {
"entity": self.entity,
}
super().__init__(client, variables, per_page) | python | wandb/apis/public.py | 1,429 | 1,435 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,465 | length | def length(self):
return None | python | wandb/apis/public.py | 1,438 | 1,439 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,466 | more | def more(self):
if self.last_response:
return self.last_response["models"]["pageInfo"]["hasNextPage"]
else:
return True | python | wandb/apis/public.py | 1,442 | 1,446 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,467 | cursor | def cursor(self):
if self.last_response:
return self.last_response["models"]["edges"][-1]["cursor"]
else:
return None | python | wandb/apis/public.py | 1,449 | 1,453 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,468 | convert_objects | def convert_objects(self):
return [
Project(self.client, self.entity, p["node"]["name"], p["node"])
for p in self.last_response["models"]["edges"]
] | python | wandb/apis/public.py | 1,455 | 1,459 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,469 | __repr__ | def __repr__(self):
return f"<Projects {self.entity}>" | python | wandb/apis/public.py | 1,461 | 1,462 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,470 | __init__ | def __init__(self, client, entity, project, attrs):
super().__init__(dict(attrs))
self.client = client
self.name = project
self.entity = entity | python | wandb/apis/public.py | 1,468 | 1,472 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,471 | path | def path(self):
return [self.entity, self.name] | python | wandb/apis/public.py | 1,475 | 1,476 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,472 | url | def url(self):
return self.client.app_url + "/".join(self.path + ["workspace"]) | python | wandb/apis/public.py | 1,479 | 1,480 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,473 | to_html | def to_html(self, height=420, hidden=False):
"""Generate HTML containing an iframe displaying this project."""
url = self.url + "?jupyter=true"
style = f"border:none;width:100%;height:{height}px;"
prefix = ""
if hidden:
style += "display:none;"
prefix = ipython.toggle_button("project")
return prefix + f"<iframe src={url!r} style={style!r}></iframe>" | python | wandb/apis/public.py | 1,482 | 1,490 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,474 | _repr_html_ | def _repr_html_(self) -> str:
return self.to_html() | python | wandb/apis/public.py | 1,492 | 1,493 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,475 | __repr__ | def __repr__(self):
return "<Project {}>".format("/".join(self.path)) | python | wandb/apis/public.py | 1,495 | 1,496 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,476 | artifacts_types | def artifacts_types(self, per_page=50):
return ProjectArtifactTypes(self.client, self.entity, self.name) | python | wandb/apis/public.py | 1,499 | 1,500 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,477 | sweeps | def sweeps(self):
query = gql(
"""
query GetSweeps($project: String!, $entity: String!) {
project(name: $project, entityName: $entity) {
totalSweeps
sweeps {
edges {
node {
...SweepFragment
}
cursor
}
pageInfo {
endCursor
hasNextPage
}
}
}
}
%s
"""
% SWEEP_FRAGMENT
)
variable_values = {"project": self.name, "entity": self.entity}
ret = self.client.execute(query, variable_values)
if ret["project"]["totalSweeps"] < 1:
return []
return [
# match format of existing public sweep apis
Sweep(
self.client,
self.entity,
self.name,
e["node"]["name"],
attrs={
"id": e["node"]["id"],
"name": e["node"]["name"],
"bestLoss": e["node"]["bestLoss"],
"config": e["node"]["config"],
},
)
for e in ret["project"]["sweeps"]["edges"]
] | python | wandb/apis/public.py | 1,503 | 1,547 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,478 | __init__ | def __init__(
self,
client: "RetryingClient",
entity: str,
project: str,
filters: Optional[Dict[str, Any]] = None,
order: Optional[str] = None,
per_page: int = 50,
include_sweeps: bool = True,
):
self.entity = entity
self.project = project
self.filters = filters or {}
self.order = order
self._sweeps = {}
self._include_sweeps = include_sweeps
variables = {
"project": self.project,
"entity": self.entity,
"order": self.order,
"filters": json.dumps(self.filters),
}
super().__init__(client, variables, per_page) | python | wandb/apis/public.py | 1,581 | 1,603 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,479 | length | def length(self):
if self.last_response:
return self.last_response["project"]["runCount"]
else:
return None | python | wandb/apis/public.py | 1,606 | 1,610 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,480 | more | def more(self):
if self.last_response:
return self.last_response["project"]["runs"]["pageInfo"]["hasNextPage"]
else:
return True | python | wandb/apis/public.py | 1,613 | 1,617 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,481 | cursor | def cursor(self):
if self.last_response:
return self.last_response["project"]["runs"]["edges"][-1]["cursor"]
else:
return None | python | wandb/apis/public.py | 1,620 | 1,624 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,482 | convert_objects | def convert_objects(self):
objs = []
if self.last_response is None or self.last_response.get("project") is None:
raise ValueError("Could not find project %s" % self.project)
for run_response in self.last_response["project"]["runs"]["edges"]:
run = Run(
self.client,
self.entity,
self.project,
run_response["node"]["name"],
run_response["node"],
include_sweeps=self._include_sweeps,
)
objs.append(run)
if self._include_sweeps and run.sweep_name:
if run.sweep_name in self._sweeps:
sweep = self._sweeps[run.sweep_name]
else:
sweep = Sweep.get(
self.client,
self.entity,
self.project,
run.sweep_name,
withRuns=False,
)
self._sweeps[run.sweep_name] = sweep
if sweep is None:
continue
run.sweep = sweep
return objs | python | wandb/apis/public.py | 1,626 | 1,658 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,483 | __repr__ | def __repr__(self):
return f"<Runs {self.entity}/{self.project}>" | python | wandb/apis/public.py | 1,660 | 1,661 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,484 | __init__ | def __init__(
self,
client: "RetryingClient",
entity: str,
project: str,
run_id: str,
attrs: Optional[Mapping] = None,
include_sweeps: bool = True,
):
"""Initialize a Run object.
Run is always initialized by calling api.runs() where api is an instance of
wandb.Api.
"""
_attrs = attrs or {}
super().__init__(dict(_attrs))
self.client = client
self._entity = entity
self.project = project
self._files = {}
self._base_dir = env.get_dir(tempfile.gettempdir())
self.id = run_id
self.sweep = None
self._include_sweeps = include_sweeps
self.dir = os.path.join(self._base_dir, *self.path)
try:
os.makedirs(self.dir)
except OSError:
pass
self._summary = None
self._state = _attrs.get("state", "not found")
self.load(force=not _attrs) | python | wandb/apis/public.py | 1,688 | 1,720 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,485 | state | def state(self):
return self._state | python | wandb/apis/public.py | 1,723 | 1,724 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,486 | entity | def entity(self):
return self._entity | python | wandb/apis/public.py | 1,727 | 1,728 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,487 | username | def username(self):
wandb.termwarn("Run.username is deprecated. Please use Run.entity instead.")
return self._entity | python | wandb/apis/public.py | 1,731 | 1,733 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,488 | storage_id | def storage_id(self):
# For compatibility with wandb.Run, which has storage IDs
# in self.storage_id and names in self.id.
return self._attrs.get("id") | python | wandb/apis/public.py | 1,736 | 1,740 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,489 | id | def id(self):
return self._attrs.get("name") | python | wandb/apis/public.py | 1,743 | 1,744 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,490 | id | def id(self, new_id):
attrs = self._attrs
attrs["name"] = new_id
return new_id | python | wandb/apis/public.py | 1,747 | 1,750 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,491 | name | def name(self):
return self._attrs.get("displayName") | python | wandb/apis/public.py | 1,753 | 1,754 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,492 | name | def name(self, new_name):
self._attrs["displayName"] = new_name
return new_name | python | wandb/apis/public.py | 1,757 | 1,759 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,493 | create | def create(cls, api, run_id=None, project=None, entity=None):
"""Create a run for the given project."""
run_id = run_id or runid.generate_id()
project = project or api.settings.get("project") or "uncategorized"
mutation = gql(
"""
mutation UpsertBucket($project: String, $entity: String, $name: String!) {
upsertBucket(input: {modelName: $project, entityName: $entity, name: $name}) {
bucket {
project {
name
entity { name }
}
id
name
}
inserted
}
}
"""
)
variables = {"entity": entity, "project": project, "name": run_id}
res = api.client.execute(mutation, variable_values=variables)
res = res["upsertBucket"]["bucket"]
return Run(
api.client,
res["project"]["entity"]["name"],
res["project"]["name"],
res["name"],
{
"id": res["id"],
"config": "{}",
"systemMetrics": "{}",
"summaryMetrics": "{}",
"tags": [],
"description": None,
"notes": None,
"state": "running",
},
) | python | wandb/apis/public.py | 1,762 | 1,801 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,494 | load | def load(self, force=False):
query = gql(
"""
query Run($project: String!, $entity: String!, $name: String!) {
project(name: $project, entityName: $entity) {
run(name: $name) {
...RunFragment
}
}
}
%s
"""
% RUN_FRAGMENT
)
if force or not self._attrs:
response = self._exec(query)
if (
response is None
or response.get("project") is None
or response["project"].get("run") is None
):
raise ValueError("Could not find run %s" % self)
self._attrs = response["project"]["run"]
self._state = self._attrs["state"]
if self._include_sweeps and self.sweep_name and not self.sweep:
# There may be a lot of runs. Don't bother pulling them all
# just for the sake of this one.
self.sweep = Sweep.get(
self.client,
self.entity,
self.project,
self.sweep_name,
withRuns=False,
)
self._attrs["summaryMetrics"] = (
json.loads(self._attrs["summaryMetrics"])
if self._attrs.get("summaryMetrics")
else {}
)
self._attrs["systemMetrics"] = (
json.loads(self._attrs["systemMetrics"])
if self._attrs.get("systemMetrics")
else {}
)
if self._attrs.get("user"):
self.user = User(self.client, self._attrs["user"])
config_user, config_raw = {}, {}
for key, value in json.loads(self._attrs.get("config") or "{}").items():
config = config_raw if key in WANDB_INTERNAL_KEYS else config_user
if isinstance(value, dict) and "value" in value:
config[key] = value["value"]
else:
config[key] = value
config_raw.update(config_user)
self._attrs["config"] = config_user
self._attrs["rawconfig"] = config_raw
return self._attrs | python | wandb/apis/public.py | 1,803 | 1,861 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,495 | wait_until_finished | def wait_until_finished(self):
query = gql(
"""
query RunState($project: String!, $entity: String!, $name: String!) {
project(name: $project, entityName: $entity) {
run(name: $name) {
state
}
}
}
"""
)
while True:
res = self._exec(query)
state = res["project"]["run"]["state"]
if state in ["finished", "crashed", "failed"]:
print(f"Run finished with status: {state}")
self._attrs["state"] = state
self._state = state
return
time.sleep(5) | python | wandb/apis/public.py | 1,864 | 1,884 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,496 | update | def update(self):
"""Persist changes to the run object to the wandb backend."""
mutation = gql(
"""
mutation UpsertBucket($id: String!, $description: String, $display_name: String, $notes: String, $tags: [String!], $config: JSONString!, $groupName: String) {
upsertBucket(input: {id: $id, description: $description, displayName: $display_name, notes: $notes, tags: $tags, config: $config, groupName: $groupName}) {
bucket {
...RunFragment
}
}
}
%s
"""
% RUN_FRAGMENT
)
_ = self._exec(
mutation,
id=self.storage_id,
tags=self.tags,
description=self.description,
notes=self.notes,
display_name=self.display_name,
config=self.json_config,
groupName=self.group,
)
self.summary.update() | python | wandb/apis/public.py | 1,887 | 1,912 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,497 | delete | def delete(self, delete_artifacts=False):
"""Delete the given run from the wandb backend."""
mutation = gql(
"""
mutation DeleteRun(
$id: ID!,
%s
) {
deleteRun(input: {
id: $id,
%s
}) {
clientMutationId
}
}
"""
%
# Older backends might not support the 'deleteArtifacts' argument,
# so only supply it when it is explicitly set.
(
"$deleteArtifacts: Boolean" if delete_artifacts else "",
"deleteArtifacts: $deleteArtifacts" if delete_artifacts else "",
)
)
self.client.execute(
mutation,
variable_values={
"id": self.storage_id,
"deleteArtifacts": delete_artifacts,
},
) | python | wandb/apis/public.py | 1,915 | 1,946 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,498 | save | def save(self):
self.update() | python | wandb/apis/public.py | 1,948 | 1,949 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,499 | json_config | def json_config(self):
config = {}
for k, v in self.config.items():
config[k] = {"value": v, "desc": None}
return json.dumps(config) | python | wandb/apis/public.py | 1,952 | 1,956 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
1,500 | _exec | def _exec(self, query, **kwargs):
"""Execute a query against the cloud backend."""
variables = {"entity": self.entity, "project": self.project, "name": self.id}
variables.update(kwargs)
return self.client.execute(query, variable_values=variables) | python | wandb/apis/public.py | 1,958 | 1,962 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.