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 |
|---|---|---|---|---|---|---|---|
4,301 | run_resume_status | def run_resume_status(
self, entity: str, project_name: str, name: str
) -> Optional[Dict[str, Any]]:
"""Check if a run exists and get resume information.
Arguments:
entity (str): The entity to scope this project to.
project_name (str): The project to download, (can include bucket)
name (str): The run to download
"""
query = gql(
"""
query RunResumeStatus($project: String, $entity: String, $name: String!) {
model(name: $project, entityName: $entity) {
id
name
entity {
id
name
}
bucket(name: $name, missingOk: true) {
id
name
summaryMetrics
displayName
logLineCount
historyLineCount
eventsLineCount
historyTail
eventsTail
config
}
}
}
"""
)
response = self.gql(
query,
variable_values={
"entity": entity,
"project": project_name,
"name": name,
},
)
if "model" not in response or "bucket" not in (response["model"] or {}):
return None
project = response["model"]
self.set_setting("project", project_name)
if "entity" in project:
self.set_setting("entity", project["entity"]["name"])
result: Dict[str, Any] = project["bucket"]
return result | python | wandb/sdk/internal/internal_api.py | 937 | 994 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,302 | check_stop_requested | def check_stop_requested(
self, project_name: str, entity_name: str, run_id: str
) -> bool:
query = gql(
"""
query RunStoppedStatus($projectName: String, $entityName: String, $runId: String!) {
project(name:$projectName, entityName:$entityName) {
run(name:$runId) {
stopped
}
}
}
"""
)
response = self.gql(
query,
variable_values={
"projectName": project_name,
"entityName": entity_name,
"runId": run_id,
},
)
project = response.get("project", None)
if not project:
return False
run = project.get("run", None)
if not run:
return False
status: bool = run["stopped"]
return status | python | wandb/sdk/internal/internal_api.py | 997 | 1,029 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,303 | format_project | def format_project(self, project: str) -> str:
return re.sub(r"\W+", "-", project.lower()).strip("-_") | python | wandb/sdk/internal/internal_api.py | 1,031 | 1,032 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,304 | upsert_project | def upsert_project(
self,
project: str,
id: Optional[str] = None,
description: Optional[str] = None,
entity: Optional[str] = None,
) -> Dict[str, Any]:
"""Create a new project.
Arguments:
project (str): The project to create
description (str, optional): A description of this project
entity (str, optional): The entity to scope this project to.
"""
mutation = gql(
"""
mutation UpsertModel($name: String!, $id: String, $entity: String!, $description: String, $repo: String) {
upsertModel(input: { id: $id, name: $name, entityName: $entity, description: $description, repo: $repo }) {
model {
name
description
}
}
}
"""
)
response = self.gql(
mutation,
variable_values={
"name": self.format_project(project),
"entity": entity or self.settings("entity"),
"description": description,
"id": id,
},
)
# TODO(jhr): Commenting out 'repo' field for cling, add back
# 'description': description, 'repo': self.git.remote_url, 'id': id})
result: Dict[str, Any] = response["upsertModel"]["model"]
return result | python | wandb/sdk/internal/internal_api.py | 1,035 | 1,073 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,305 | entity_is_team | def entity_is_team(self, entity: str) -> bool:
query = gql(
"""
query EntityIsTeam($entity: String!) {
entity(name: $entity) {
id
isTeam
}
}
"""
)
variable_values = {
"entity": entity,
}
res = self.gql(query, variable_values)
if res.get("entity") is None:
raise Exception(
f"Error fetching entity {entity} "
"check that you have access to this entity"
)
is_team: bool = res["entity"]["isTeam"]
return is_team | python | wandb/sdk/internal/internal_api.py | 1,076 | 1,099 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,306 | get_project_run_queues | def get_project_run_queues(self, entity: str, project: str) -> List[Dict[str, str]]:
query = gql(
"""
query ProjectRunQueues($entity: String!, $projectName: String!){
project(entityName: $entity, name: $projectName) {
runQueues {
id
name
createdBy
access
}
}
}
"""
)
variable_values = {
"projectName": project,
"entity": entity,
}
res = self.gql(query, variable_values)
if res.get("project") is None:
# circular dependency: (LAUNCH_DEFAULT_PROJECT = model-registry)
if project == "model-registry":
msg = (
f"Error fetching run queues for {entity} "
"check that you have access to this entity and project"
)
else:
msg = (
f"Error fetching run queues for {entity}/{project} "
"check that you have access to this entity and project"
)
raise Exception(msg)
project_run_queues: List[Dict[str, str]] = res["project"]["runQueues"]
return project_run_queues | python | wandb/sdk/internal/internal_api.py | 1,102 | 1,139 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,307 | create_run_queue | def create_run_queue(
self, entity: str, project: str, queue_name: str, access: str
) -> Optional[Dict[str, Any]]:
query = gql(
"""
mutation createRunQueue($entity: String!, $project: String!, $queueName: String!, $access: RunQueueAccessType!){
createRunQueue(
input: {
entityName: $entity,
projectName: $project,
queueName: $queueName,
access: $access
}
) {
success
queueID
}
}
"""
)
variable_values = {
"project": project,
"entity": entity,
"access": access,
"queueName": queue_name,
}
result: Optional[Dict[str, Any]] = self.gql(query, variable_values)[
"createRunQueue"
]
return result | python | wandb/sdk/internal/internal_api.py | 1,142 | 1,171 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,308 | push_to_run_queue_by_name | def push_to_run_queue_by_name(
self, entity: str, project: str, queue_name: str, run_spec: str
) -> Optional[Dict[str, Any]]:
"""Queryless mutation, should be used before legacy fallback method."""
mutation = gql(
"""
mutation pushToRunQueueByName(
$entityName: String!,
$projectName: String!,
$queueName: String!,
$runSpec: JSONString!,
) {
pushToRunQueueByName(
input: {
entityName: $entityName,
projectName: $projectName,
queueName: $queueName,
runSpec: $runSpec
}
) {
runQueueItemId
runSpec
}
}
"""
)
variables = {
"entityName": entity,
"projectName": project,
"queueName": queue_name,
"runSpec": run_spec,
}
try:
result: Optional[Dict[str, Any]] = self.gql(
mutation, variables, check_retry_fn=util.no_retry_4xx
).get("pushToRunQueueByName")
if not result:
return None
if result.get("runSpec"):
run_spec = json.loads(str(result["runSpec"]))
result["runSpec"] = run_spec
return result
except Exception as e:
if (
'Cannot query field "runSpec" on type "PushToRunQueueByNamePayload"'
not in str(e)
):
return None
mutation_no_runspec = gql(
"""
mutation pushToRunQueueByName(
$entityName: String!,
$projectName: String!,
$queueName: String!,
$runSpec: JSONString!,
) {
pushToRunQueueByName(
input: {
entityName: $entityName,
projectName: $projectName,
queueName: $queueName,
runSpec: $runSpec
}
) {
runQueueItemId
}
}
"""
)
try:
result = self.gql(
mutation_no_runspec, variables, check_retry_fn=util.no_retry_4xx
).get("pushToRunQueueByName")
except Exception:
result = None
return result | python | wandb/sdk/internal/internal_api.py | 1,174 | 1,255 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,309 | push_to_run_queue | def push_to_run_queue(
self,
queue_name: str,
launch_spec: Dict[str, str],
project_queue: str,
) -> Optional[Dict[str, Any]]:
entity = launch_spec["entity"]
run_spec = json.dumps(launch_spec)
push_result = self.push_to_run_queue_by_name(
entity, project_queue, queue_name, run_spec
)
if push_result:
return push_result
""" Legacy Method """
queues_found = self.get_project_run_queues(entity, project_queue)
matching_queues = [
q
for q in queues_found
if q["name"] == queue_name
# ensure user has access to queue
and (
# TODO: User created queues in the UI have USER access
q["access"] in ["PROJECT", "USER"]
or q["createdBy"] == self.default_entity
)
]
if not matching_queues:
# in the case of a missing default queue. create it
if queue_name == "default":
wandb.termlog(
f"No default queue existing for entity: {entity} in project: {project_queue}, creating one."
)
res = self.create_run_queue(
launch_spec["entity"],
project_queue,
queue_name,
access="PROJECT",
)
if res is None or res.get("queueID") is None:
wandb.termerror(
f"Unable to create default queue for entity: {entity} on project: {project_queue}. Run could not be added to a queue"
)
return None
queue_id = res["queueID"]
else:
wandb.termwarn(
f"Unable to push to run queue {project_queue}/{queue_name}. Queue not found."
)
return None
elif len(matching_queues) > 1:
wandb.termerror(
f"Unable to push to run queue {queue_name}. More than one queue found with this name."
)
return None
else:
queue_id = matching_queues[0]["id"]
mutation = gql(
"""
mutation pushToRunQueue($queueID: ID!, $runSpec: JSONString!) {
pushToRunQueue(
input: {
queueID: $queueID,
runSpec: $runSpec
}
) {
runQueueItemId
}
}
"""
)
spec_json = json.dumps(launch_spec)
response = self.gql(
mutation, variable_values={"queueID": queue_id, "runSpec": spec_json}
)
result: Optional[Dict[str, Any]] = response["pushToRunQueue"]
return result | python | wandb/sdk/internal/internal_api.py | 1,258 | 1,339 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,310 | pop_from_run_queue | def pop_from_run_queue(
self,
queue_name: str,
entity: Optional[str] = None,
project: Optional[str] = None,
agent_id: Optional[str] = None,
) -> Optional[Dict[str, Any]]:
mutation = gql(
"""
mutation popFromRunQueue($entity: String!, $project: String!, $queueName: String!, $launchAgentId: ID) {
popFromRunQueue(input: {
entityName: $entity,
projectName: $project,
queueName: $queueName,
launchAgentId: $launchAgentId
}) {
runQueueItemId
runSpec
}
}
"""
)
response = self.gql(
mutation,
variable_values={
"entity": entity,
"project": project,
"queueName": queue_name,
"launchAgentId": agent_id,
},
)
result: Optional[Dict[str, Any]] = response["popFromRunQueue"]
return result | python | wandb/sdk/internal/internal_api.py | 1,342 | 1,374 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,311 | ack_run_queue_item | def ack_run_queue_item(self, item_id: str, run_id: Optional[str] = None) -> bool:
mutation = gql(
"""
mutation ackRunQueueItem($itemId: ID!, $runId: String!) {
ackRunQueueItem(input: { runQueueItemId: $itemId, runName: $runId }) {
success
}
}
"""
)
response = self.gql(
mutation, variable_values={"itemId": item_id, "runId": str(run_id)}
)
if not response["ackRunQueueItem"]["success"]:
raise CommError(
"Error acking run queue item. Item may have already been acknowledged by another process"
)
result: bool = response["ackRunQueueItem"]["success"]
return result | python | wandb/sdk/internal/internal_api.py | 1,377 | 1,395 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,312 | create_launch_agent | def create_launch_agent(
self,
entity: str,
project: str,
queues: List[str],
gorilla_agent_support: bool,
) -> dict:
project_queues = self.get_project_run_queues(entity, project)
if not project_queues:
# create default queue if it doesn't already exist
default = self.create_run_queue(
entity, project, "default", access="PROJECT"
)
if default is None or default.get("queueID") is None:
raise CommError(
"Unable to create default queue for {}/{}. No queues for agent to poll".format(
entity, project
)
)
project_queues = [{"id": default["queueID"], "name": "default"}]
polling_queue_ids = [
q["id"] for q in project_queues if q["name"] in queues
] # filter to poll specified queues
if len(polling_queue_ids) != len(queues):
raise CommError(
f"Could not start launch agent: Not all of requested queues ({', '.join(queues)}) found. "
f"Available queues for this project: {','.join([q['name'] for q in project_queues])}"
)
if not gorilla_agent_support:
# if gorilla doesn't support launch agents, return a client-generated id
return {
"success": True,
"launchAgentId": None,
}
hostname = socket.gethostname()
mutation = gql(
"""
mutation createLaunchAgent($entity: String!, $project: String!, $queues: [ID!]!, $hostname: String!){
createLaunchAgent(
input: {
entityName: $entity,
projectName: $project,
runQueues: $queues,
hostname: $hostname
}
) {
launchAgentId
}
}
"""
)
variable_values = {
"entity": entity,
"project": project,
"queues": polling_queue_ids,
"hostname": hostname,
}
result: dict = self.gql(mutation, variable_values)["createLaunchAgent"]
return result | python | wandb/sdk/internal/internal_api.py | 1,398 | 1,458 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,313 | update_launch_agent_status | def update_launch_agent_status(
self,
agent_id: str,
status: str,
gorilla_agent_support: bool,
) -> dict:
if not gorilla_agent_support:
# if gorilla doesn't support launch agents, this is a no-op
return {
"success": True,
}
mutation = gql(
"""
mutation updateLaunchAgent($agentId: ID!, $agentStatus: String){
updateLaunchAgent(
input: {
launchAgentId: $agentId
agentStatus: $agentStatus
}
) {
success
}
}
"""
)
variable_values = {
"agentId": agent_id,
"agentStatus": status,
}
result: dict = self.gql(mutation, variable_values)["updateLaunchAgent"]
return result | python | wandb/sdk/internal/internal_api.py | 1,461 | 1,492 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,314 | get_launch_agent | def get_launch_agent(self, agent_id: str, gorilla_agent_support: bool) -> dict:
if not gorilla_agent_support:
return {
"id": None,
"name": "",
"stopPolling": False,
}
query = gql(
"""
query LaunchAgent($agentId: ID!) {
launchAgent(id: $agentId) {
id
name
runQueues
hostname
agentStatus
stopPolling
heartbeatAt
}
}
"""
)
variable_values = {
"agentId": agent_id,
}
result: dict = self.gql(query, variable_values)["launchAgent"]
return result | python | wandb/sdk/internal/internal_api.py | 1,495 | 1,521 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,315 | upsert_run | def upsert_run(
self,
id: Optional[str] = None,
name: Optional[str] = None,
project: Optional[str] = None,
host: Optional[str] = None,
group: Optional[str] = None,
tags: Optional[List[str]] = None,
config: Optional[dict] = None,
description: Optional[str] = None,
entity: Optional[str] = None,
state: Optional[str] = None,
display_name: Optional[str] = None,
notes: Optional[str] = None,
repo: Optional[str] = None,
job_type: Optional[str] = None,
program_path: Optional[str] = None,
commit: Optional[str] = None,
sweep_name: Optional[str] = None,
summary_metrics: Optional[str] = None,
num_retries: Optional[int] = None,
) -> Tuple[dict, bool, Optional[List]]:
"""Update a run.
Arguments:
id (str, optional): The existing run to update
name (str, optional): The name of the run to create
group (str, optional): Name of the group this run is a part of
project (str, optional): The name of the project
host (str, optional): The name of the host
tags (list, optional): A list of tags to apply to the run
config (dict, optional): The latest config params
description (str, optional): A description of this project
entity (str, optional): The entity to scope this project to.
display_name (str, optional): The display name of this project
notes (str, optional): Notes about this run
repo (str, optional): Url of the program's repository.
state (str, optional): State of the program.
job_type (str, optional): Type of job, e.g 'train'.
program_path (str, optional): Path to the program.
commit (str, optional): The Git SHA to associate the run with
sweep_name (str, optional): The name of the sweep this run is a part of
summary_metrics (str, optional): The JSON summary metrics
num_retries (int, optional): Number of retries
"""
query_string = """
mutation UpsertBucket(
$id: String,
$name: String,
$project: String,
$entity: String,
$groupName: String,
$description: String,
$displayName: String,
$notes: String,
$commit: String,
$config: JSONString,
$host: String,
$debug: Boolean,
$program: String,
$repo: String,
$jobType: String,
$state: String,
$sweep: String,
$tags: [String!],
$summaryMetrics: JSONString,
) {
upsertBucket(input: {
id: $id,
name: $name,
groupName: $groupName,
modelName: $project,
entityName: $entity,
description: $description,
displayName: $displayName,
notes: $notes,
config: $config,
commit: $commit,
host: $host,
debug: $debug,
jobProgram: $program,
jobRepo: $repo,
jobType: $jobType,
state: $state,
sweep: $sweep,
tags: $tags,
summaryMetrics: $summaryMetrics,
}) {
bucket {
id
name
displayName
description
config
sweepName
project {
id
name
entity {
id
name
}
}
}
inserted
_Server_Settings_
}
}
"""
self.server_settings_introspection()
server_settings_string = (
"""
serverSettings {
serverMessages{
utfText
plainText
htmlText
messageType
messageLevel
}
}
"""
if self._server_settings_type
else ""
)
query_string = query_string.replace("_Server_Settings_", server_settings_string)
mutation = gql(query_string)
config_str = json.dumps(config) if config else None
if not description or description.isspace():
description = None
kwargs = {}
if num_retries is not None:
kwargs["num_retries"] = num_retries
variable_values = {
"id": id,
"entity": entity or self.settings("entity"),
"name": name,
"project": project or util.auto_project_name(program_path),
"groupName": group,
"tags": tags,
"description": description,
"config": config_str,
"commit": commit,
"displayName": display_name,
"notes": notes,
"host": None if self.settings().get("anonymous") == "true" else host,
"debug": env.is_debug(env=self._environ),
"repo": repo,
"program": program_path,
"jobType": job_type,
"state": state,
"sweep": sweep_name,
"summaryMetrics": summary_metrics,
}
# retry conflict errors for 2 minutes, default to no_auth_retry
check_retry_fn = util.make_check_retry_fn(
check_fn=util.check_retry_conflict_or_gone,
check_timedelta=datetime.timedelta(minutes=2),
fallback_retry_fn=util.no_retry_auth,
)
response = self.gql(
mutation,
variable_values=variable_values,
check_retry_fn=check_retry_fn,
**kwargs,
)
run_obj: Dict[str, Dict[str, Dict[str, str]]] = response["upsertBucket"][
"bucket"
]
project_obj: Dict[str, Dict[str, str]] = run_obj.get("project", {})
if project_obj:
self.set_setting("project", project_obj["name"])
entity_obj = project_obj.get("entity", {})
if entity_obj:
self.set_setting("entity", entity_obj["name"])
server_messages = None
if self._server_settings_type:
server_messages = (
response["upsertBucket"]
.get("serverSettings", {})
.get("serverMessages", [])
)
return (
response["upsertBucket"]["bucket"],
response["upsertBucket"]["inserted"],
server_messages,
) | python | wandb/sdk/internal/internal_api.py | 1,524 | 1,718 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,316 | get_run_info | def get_run_info(
self,
entity: str,
project: str,
name: str,
) -> dict:
query = gql(
"""
query RunInfo($project: String!, $entity: String!, $name: String!) {
project(name: $project, entityName: $entity) {
run(name: $name) {
runInfo {
program
args
os
python
colab
executable
codeSaved
cpuCount
gpuCount
gpu
git {
remote
commit
}
}
}
}
}
"""
)
variable_values = {"project": project, "entity": entity, "name": name}
res = self.gql(query, variable_values)
if res.get("project") is None:
raise CommError(
"Error fetching run info for {}/{}/{}. Check that this project exists and you have access to this entity and project".format(
entity, project, name
)
)
elif res["project"].get("run") is None:
raise CommError(
"Error fetching run info for {}/{}/{}. Check that this run id exists".format(
entity, project, name
)
)
run_info: dict = res["project"]["run"]["runInfo"]
return run_info | python | wandb/sdk/internal/internal_api.py | 1,721 | 1,768 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,317 | get_run_state | def get_run_state(self, entity: str, project: str, name: str) -> str:
query = gql(
"""
query RunState(
$project: String!,
$entity: String!,
$name: String!) {
project(name: $project, entityName: $entity) {
run(name: $name) {
state
}
}
}
"""
)
variable_values = {
"project": project,
"entity": entity,
"name": name,
}
res = self.gql(query, variable_values)
if res.get("project") is None or res["project"].get("run") is None:
raise CommError(f"Error fetching run state for {entity}/{project}/{name}.")
run_state: str = res["project"]["run"]["state"]
return run_state | python | wandb/sdk/internal/internal_api.py | 1,771 | 1,795 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,318 | upload_urls | def upload_urls(
self,
project: str,
files: Union[List[str], Dict[str, IO]],
run: Optional[str] = None,
entity: Optional[str] = None,
description: Optional[str] = None,
) -> Tuple[str, List[str], Dict[str, Dict[str, Any]]]:
"""Generate temporary resumable upload urls.
Arguments:
project (str): The project to download
files (list or dict): The filenames to upload
run (str, optional): The run to upload to
entity (str, optional): The entity to scope this project to. Defaults to wandb models
description (str, optional): description
Returns:
(bucket_id, file_info)
bucket_id: id of bucket we uploaded to
file_info: A dict of filenames and urls, also indicates if this revision already has uploaded files.
{
'weights.h5': { "url": "https://weights.url" },
'model.json': { "url": "https://model.json", "updatedAt": '2013-04-26T22:22:23.832Z', 'md5': 'mZFLkyvTelC5g8XnyQrpOw==' },
}
"""
query = gql(
"""
query RunUploadUrls($name: String!, $files: [String]!, $entity: String, $run: String!, $description: String) {
model(name: $name, entityName: $entity) {
bucket(name: $run, desc: $description) {
id
files(names: $files) {
uploadHeaders
edges {
node {
name
url(upload: true)
updatedAt
}
}
}
}
}
}
"""
)
run_id = run or self.current_run_id
assert run_id, "run must be specified"
entity = entity or self.settings("entity")
query_result = self.gql(
query,
variable_values={
"name": project,
"run": run_id,
"entity": entity,
"description": description,
"files": [file for file in files],
},
)
run_obj = query_result["model"]["bucket"]
if run_obj:
result = {
file["name"]: file for file in self._flatten_edges(run_obj["files"])
}
return run_obj["id"], run_obj["files"]["uploadHeaders"], result
else:
raise CommError(f"Run does not exist {entity}/{project}/{run_id}.") | python | wandb/sdk/internal/internal_api.py | 1,798 | 1,866 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,319 | download_urls | def download_urls(
self,
project: str,
run: Optional[str] = None,
entity: Optional[str] = None,
) -> Dict[str, Dict[str, str]]:
"""Generate download urls.
Arguments:
project (str): The project to download
run (str): The run to upload to
entity (str, optional): The entity to scope this project to. Defaults to wandb models
Returns:
A dict of extensions and urls
{
'weights.h5': { "url": "https://weights.url", "updatedAt": '2013-04-26T22:22:23.832Z', 'md5': 'mZFLkyvTelC5g8XnyQrpOw==' },
'model.json': { "url": "https://model.url", "updatedAt": '2013-04-26T22:22:23.832Z', 'md5': 'mZFLkyvTelC5g8XnyQrpOw==' }
}
"""
query = gql(
"""
query RunDownloadUrls($name: String!, $entity: String, $run: String!) {
model(name: $name, entityName: $entity) {
bucket(name: $run) {
files {
edges {
node {
name
url
md5
updatedAt
}
}
}
}
}
}
"""
)
run = run or self.current_run_id
assert run, "run must be specified"
entity = entity or self.settings("entity")
query_result = self.gql(
query,
variable_values={
"name": project,
"run": run,
"entity": entity,
},
)
if query_result["model"] is None:
raise CommError(f"Run does not exist {entity}/{project}/{run}.")
files = self._flatten_edges(query_result["model"]["bucket"]["files"])
return {file["name"]: file for file in files if file} | python | wandb/sdk/internal/internal_api.py | 1,869 | 1,924 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,320 | download_url | def download_url(
self,
project: str,
file_name: str,
run: Optional[str] = None,
entity: Optional[str] = None,
) -> Optional[Dict[str, str]]:
"""Generate download urls.
Arguments:
project (str): The project to download
file_name (str): The name of the file to download
run (str): The run to upload to
entity (str, optional): The entity to scope this project to. Defaults to wandb models
Returns:
A dict of extensions and urls
{ "url": "https://weights.url", "updatedAt": '2013-04-26T22:22:23.832Z', 'md5': 'mZFLkyvTelC5g8XnyQrpOw==' }
"""
query = gql(
"""
query RunDownloadUrl($name: String!, $fileName: String!, $entity: String, $run: String!) {
model(name: $name, entityName: $entity) {
bucket(name: $run) {
files(names: [$fileName]) {
edges {
node {
name
url
md5
updatedAt
}
}
}
}
}
}
"""
)
run = run or self.current_run_id
assert run, "run must be specified"
query_result = self.gql(
query,
variable_values={
"name": project,
"run": run,
"fileName": file_name,
"entity": entity or self.settings("entity"),
},
)
if query_result["model"]:
files = self._flatten_edges(query_result["model"]["bucket"]["files"])
return files[0] if len(files) > 0 and files[0].get("updatedAt") else None
else:
return None | python | wandb/sdk/internal/internal_api.py | 1,927 | 1,983 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,321 | download_file | def download_file(self, url: str) -> Tuple[int, requests.Response]:
"""Initiate a streaming download.
Arguments:
url (str): The url to download
Returns:
A tuple of the content length and the streaming response
"""
response = requests.get(url, auth=("user", self.api_key), stream=True) # type: ignore
response.raise_for_status()
return int(response.headers.get("content-length", 0)), response | python | wandb/sdk/internal/internal_api.py | 1,986 | 1,997 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,322 | download_write_file | def download_write_file(
self,
metadata: Dict[str, str],
out_dir: Optional[str] = None,
) -> Tuple[str, Optional[requests.Response]]:
"""Download a file from a run and write it to wandb/.
Arguments:
metadata (obj): The metadata object for the file to download. Comes from Api.download_urls().
out_dir (str, optional): The directory to write the file to. Defaults to wandb/
Returns:
A tuple of the file's local path and the streaming response. The streaming response is None if the file
already existed and was up-to-date.
"""
filename = metadata["name"]
path = os.path.join(out_dir or self.settings("wandb_dir"), filename)
if self.file_current(filename, B64MD5(metadata["md5"])):
return path, None
size, response = self.download_file(metadata["url"])
with util.fsync_open(path, "wb") as file:
for data in response.iter_content(chunk_size=1024):
file.write(data)
return path, response | python | wandb/sdk/internal/internal_api.py | 2,000 | 2,026 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,323 | upload_file_azure | def upload_file_azure(
self, url: str, file: Any, extra_headers: Dict[str, str]
) -> None:
"""Upload a file to azure."""
from azure.core.exceptions import AzureError # type: ignore
# Configure the client without retries so our existing logic can handle them
client = self._azure_blob_module.BlobClient.from_blob_url(
url, retry_policy=self._azure_blob_module.LinearRetry(retry_total=0)
)
try:
if extra_headers.get("Content-MD5") is not None:
md5: Optional[bytes] = base64.b64decode(extra_headers["Content-MD5"])
else:
md5 = None
content_settings = self._azure_blob_module.ContentSettings(
content_md5=md5,
content_type=extra_headers.get("Content-Type"),
)
client.upload_blob(
file,
max_concurrency=4,
length=len(file),
overwrite=True,
content_settings=content_settings,
)
except AzureError as e:
if hasattr(e, "response"):
response = requests.models.Response()
response.status_code = e.response.status_code
response.headers = e.response.headers
raise requests.exceptions.RequestException(e.message, response=response)
else:
raise requests.exceptions.ConnectionError(e.message) | python | wandb/sdk/internal/internal_api.py | 2,028 | 2,061 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,324 | upload_file | def upload_file(
self,
url: str,
file: IO[bytes],
callback: Optional["ProgressFn"] = None,
extra_headers: Optional[Dict[str, str]] = None,
) -> Optional[requests.Response]:
"""Upload a file to W&B with failure resumption.
Arguments:
url: The url to download
file: The path to the file you want to upload
callback: A callback which is passed the number of
bytes uploaded since the last time it was called, used to report progress
extra_headers: A dictionary of extra headers to send with the request
Returns:
The `requests` library response object
"""
extra_headers = extra_headers.copy() if extra_headers else {}
response: Optional[requests.Response] = None
progress = Progress(file, callback=callback)
try:
if "x-ms-blob-type" in extra_headers and self._azure_blob_module:
self.upload_file_azure(url, progress, extra_headers)
else:
if "x-ms-blob-type" in extra_headers:
wandb.termwarn(
"Azure uploads over 256MB require the azure SDK, install with pip install wandb[azure]",
repeat=False,
)
response = self._upload_file_session.put(
url, data=progress, headers=extra_headers
)
response.raise_for_status()
except requests.exceptions.RequestException as e:
logger.error(f"upload_file exception {url}: {e}")
request_headers = e.request.headers if e.request is not None else ""
logger.error(f"upload_file request headers: {request_headers}")
response_content = e.response.content if e.response is not None else ""
logger.error(f"upload_file response body: {response_content}")
status_code = e.response.status_code if e.response is not None else 0
# S3 reports retryable request timeouts out-of-band
is_aws_retryable = (
"x-amz-meta-md5" in extra_headers
and status_code == 400
and "RequestTimeout" in str(response_content)
)
# We need to rewind the file for the next retry (the file passed in is seeked to 0)
progress.rewind()
# Retry errors from cloud storage or local network issues
if (
status_code in (308, 408, 409, 429, 500, 502, 503, 504)
or isinstance(
e,
(requests.exceptions.Timeout, requests.exceptions.ConnectionError),
)
or is_aws_retryable
):
_e = retry.TransientError(exc=e)
raise _e.with_traceback(sys.exc_info()[2])
else:
wandb._sentry.reraise(e)
return response | python | wandb/sdk/internal/internal_api.py | 2,063 | 2,127 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,325 | upload_file_async | async def upload_file_async(
self,
url: str,
file: IO[bytes],
callback: Optional["ProgressFn"] = None,
extra_headers: Optional[Dict[str, str]] = None,
) -> None:
"""An async not-quite-equivalent version of `upload_file`.
Differences from `upload_file`:
- This method doesn't implement Azure uploads. (The Azure SDK supports
async, but it's nontrivial to use it here.) If the upload looks like
it's destined for Azure, this method will delegate to the sync impl.
- Consequently, this method doesn't return the response object.
(Because it might fall back to the sync impl, it would sometimes
return a `requests.Response` and sometimes an `httpx.Response`.)
- This method doesn't wrap retryable errors in `TransientError`.
It leaves that determination to the caller.
"""
must_delegate = False
if httpx is None:
wandb.termwarn( # type: ignore[unreachable]
"async file-uploads require `pip install wandb[async]`; falling back to sync implementation",
repeat=False,
)
must_delegate = True
if extra_headers is not None and "x-ms-blob-type" in extra_headers:
wandb.termwarn(
"async file-uploads don't support Azure; falling back to sync implementation",
repeat=False,
)
must_delegate = True
if must_delegate:
await asyncio.get_event_loop().run_in_executor(
None,
lambda: self.upload_file_retry(
url=url,
file=file,
callback=callback,
extra_headers=extra_headers,
),
)
return
if self._async_httpx_client is None:
self._async_httpx_client = httpx.AsyncClient()
progress = AsyncProgress(Progress(file, callback=callback))
try:
response = await self._async_httpx_client.put(
url=url,
content=progress,
headers={
"Content-Length": str(len(progress)),
**(extra_headers if extra_headers is not None else {}),
},
)
response.raise_for_status()
except Exception as e:
progress.rewind()
logger.error(f"upload_file_async exception {url}: {e}")
if isinstance(e, httpx.RequestError):
logger.error(f"upload_file_async request headers: {e.request.headers}")
if isinstance(e, httpx.HTTPStatusError):
logger.error(f"upload_file_async response body: {e.response.content!r}")
raise | python | wandb/sdk/internal/internal_api.py | 2,129 | 2,198 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,326 | upload_file_retry_async | async def upload_file_retry_async(
self,
url: str,
file: IO[bytes],
callback: Optional["ProgressFn"] = None,
extra_headers: Optional[Dict[str, str]] = None,
num_retries: int = 100,
) -> None:
backoff = retry.FilteredBackoff(
filter=check_httpx_exc_retriable,
wrapped=retry.ExponentialBackoff(
initial_sleep=datetime.timedelta(seconds=1),
max_sleep=datetime.timedelta(seconds=60),
max_retries=num_retries,
timeout_at=datetime.datetime.now() + datetime.timedelta(days=7),
),
)
await retry.retry_async(
backoff=backoff,
fn=self.upload_file_async,
url=url,
file=file,
callback=callback,
extra_headers=extra_headers,
) | python | wandb/sdk/internal/internal_api.py | 2,200 | 2,225 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,327 | register_agent | def register_agent(
self,
host: str,
sweep_id: Optional[str] = None,
project_name: Optional[str] = None,
entity: Optional[str] = None,
) -> dict:
"""Register a new agent.
Arguments:
host (str): hostname
sweep_id (str): sweep id
project_name: (str): model that contains sweep
entity: (str): entity that contains sweep
"""
mutation = gql(
"""
mutation CreateAgent(
$host: String!
$projectName: String,
$entityName: String,
$sweep: String!
) {
createAgent(input: {
host: $host,
projectName: $projectName,
entityName: $entityName,
sweep: $sweep,
}) {
agent {
id
}
}
}
"""
)
if entity is None:
entity = self.settings("entity")
if project_name is None:
project_name = self.settings("project")
response = self.gql(
mutation,
variable_values={
"host": host,
"entityName": entity,
"projectName": project_name,
"sweep": sweep_id,
},
check_retry_fn=util.no_retry_4xx,
)
result: dict = response["createAgent"]["agent"]
return result | python | wandb/sdk/internal/internal_api.py | 2,228 | 2,280 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,328 | agent_heartbeat | def agent_heartbeat(
self, agent_id: str, metrics: dict, run_states: dict
) -> List[str]:
"""Notify server about agent state, receive commands.
Arguments:
agent_id (str): agent_id
metrics (dict): system metrics
run_states (dict): run_id: state mapping
Returns:
List of commands to execute.
"""
mutation = gql(
"""
mutation Heartbeat(
$id: ID!,
$metrics: JSONString,
$runState: JSONString
) {
agentHeartbeat(input: {
id: $id,
metrics: $metrics,
runState: $runState
}) {
agent {
id
}
commands
}
}
"""
)
if agent_id is None:
raise ValueError("Cannot call heartbeat with an unregistered agent.")
try:
response = self.gql(
mutation,
variable_values={
"id": agent_id,
"metrics": json.dumps(metrics),
"runState": json.dumps(run_states),
},
timeout=60,
)
except Exception as e:
# GQL raises exceptions with stringified python dictionaries :/
message = ast.literal_eval(e.args[0])["message"]
logger.error("Error communicating with W&B: %s", message)
return []
else:
result: List[str] = json.loads(response["agentHeartbeat"]["commands"])
return result | python | wandb/sdk/internal/internal_api.py | 2,282 | 2,335 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,329 | _validate_config_and_fill_distribution | def _validate_config_and_fill_distribution(config: dict) -> dict:
# verify that parameters are well specified.
# TODO(dag): deprecate this in favor of jsonschema validation once
# apiVersion 2 is released and local controller is integrated with
# wandb/client.
# avoid modifying the original config dict in
# case it is reused outside the calling func
config = deepcopy(config)
# explicitly cast to dict in case config was passed as a sweepconfig
# sweepconfig does not serialize cleanly to yaml and breaks graphql,
# but it is a subclass of dict, so this conversion is clean
config = dict(config)
if "parameters" not in config:
raise ValueError("sweep config must have a parameters section")
for parameter_name in config["parameters"]:
parameter = config["parameters"][parameter_name]
if "min" in parameter and "max" in parameter:
if "distribution" not in parameter:
if isinstance(parameter["min"], int) and isinstance(
parameter["max"], int
):
parameter["distribution"] = "int_uniform"
elif isinstance(parameter["min"], float) and isinstance(
parameter["max"], float
):
parameter["distribution"] = "uniform"
else:
raise ValueError(
"Parameter %s is ambiguous, please specify bounds as both floats (for a float_"
"uniform distribution) or ints (for an int_uniform distribution)."
% parameter_name
)
return config | python | wandb/sdk/internal/internal_api.py | 2,338 | 2,374 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,330 | upsert_sweep | def upsert_sweep(
self,
config: dict,
controller: Optional[str] = None,
launch_scheduler: Optional[str] = None,
scheduler: Optional[str] = None,
obj_id: Optional[str] = None,
project: Optional[str] = None,
entity: Optional[str] = None,
state: Optional[str] = None,
) -> Tuple[str, List[str]]:
"""Upsert a sweep object.
Arguments:
config (dict): sweep config (will be converted to yaml)
controller (str): controller to use
launch_scheduler (str): launch scheduler to use
scheduler (str): scheduler to use
obj_id (str): object id
project (str): project to use
entity (str): entity to use
state (str): state
"""
project_query = """
project {
id
name
entity {
id
name
}
}
"""
mutation_str = """
mutation UpsertSweep(
$id: ID,
$config: String,
$description: String,
$entityName: String,
$projectName: String,
$controller: JSONString,
$scheduler: JSONString,
$state: String
) {
upsertSweep(input: {
id: $id,
config: $config,
description: $description,
entityName: $entityName,
projectName: $projectName,
controller: $controller,
scheduler: $scheduler,
state: $state
}) {
sweep {
name
_PROJECT_QUERY_
}
configValidationWarnings
}
}
"""
# TODO(jhr): we need protocol versioning to know schema is not supported
# for now we will just try both new and old query
# launchScheduler was introduced in core v0.14.0
mutation_4 = gql(
mutation_str.replace(
"$controller: JSONString,",
"$controller: JSONString,$launchScheduler: JSONString,",
)
.replace(
"controller: $controller,",
"controller: $controller,launchScheduler: $launchScheduler,",
)
.replace("_PROJECT_QUERY_", project_query)
)
# mutation 3 maps to backend that can support CLI version of at least 0.10.31
mutation_3 = gql(mutation_str.replace("_PROJECT_QUERY_", project_query))
mutation_2 = gql(
mutation_str.replace("_PROJECT_QUERY_", project_query).replace(
"configValidationWarnings", ""
)
)
mutation_1 = gql(
mutation_str.replace("_PROJECT_QUERY_", "").replace(
"configValidationWarnings", ""
)
)
# TODO(dag): replace this with a query for protocol versioning
mutations = [mutation_4, mutation_3, mutation_2, mutation_1]
config = self._validate_config_and_fill_distribution(config)
err: Optional[Exception] = None
for mutation in mutations:
try:
response = self.gql(
mutation,
variable_values={
"id": obj_id,
"config": yaml.dump(config),
"description": config.get("description"),
"entityName": entity or self.settings("entity"),
"projectName": project or self.settings("project"),
"controller": controller,
"launchScheduler": launch_scheduler,
"scheduler": scheduler,
},
check_retry_fn=util.no_retry_4xx,
)
except UsageError as e:
raise e
except Exception as e:
# graphql schema exception is generic
err = e
continue
err = None
break
if err:
raise err
sweep: Dict[str, Dict[str, Dict]] = response["upsertSweep"]["sweep"]
project_obj: Dict[str, Dict] = sweep.get("project", {})
if project_obj:
self.set_setting("project", project_obj["name"])
entity_obj: dict = project_obj.get("entity", {})
if entity_obj:
self.set_setting("entity", entity_obj["name"])
warnings = response["upsertSweep"].get("configValidationWarnings", [])
return response["upsertSweep"]["sweep"]["name"], warnings | python | wandb/sdk/internal/internal_api.py | 2,377 | 2,510 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,331 | create_anonymous_api_key | def create_anonymous_api_key(self) -> str:
"""Create a new API key belonging to a new anonymous user."""
mutation = gql(
"""
mutation CreateAnonymousApiKey {
createAnonymousEntity(input: {}) {
apiKey {
name
}
}
}
"""
)
response = self.gql(mutation, variable_values={})
key: str = response["createAnonymousEntity"]["apiKey"]["name"]
return key | python | wandb/sdk/internal/internal_api.py | 2,513 | 2,529 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,332 | file_current | def file_current(fname: str, md5: B64MD5) -> bool:
"""Checksum a file and compare the md5 with the known md5."""
return os.path.isfile(fname) and md5_file_b64(fname) == md5 | python | wandb/sdk/internal/internal_api.py | 2,532 | 2,534 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,333 | pull | def pull(
self, project: str, run: Optional[str] = None, entity: Optional[str] = None
) -> "List[requests.Response]":
"""Download files from W&B.
Arguments:
project (str): The project to download
run (str, optional): The run to upload to
entity (str, optional): The entity to scope this project to. Defaults to wandb models
Returns:
The `requests` library response object
"""
project, run = self.parse_slug(project, run=run)
urls = self.download_urls(project, run, entity)
responses = []
for filename in urls:
_, response = self.download_write_file(urls[filename])
if response:
responses.append(response)
return responses | python | wandb/sdk/internal/internal_api.py | 2,537 | 2,558 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,334 | get_project | def get_project(self) -> str:
project: str = self.settings("project")
return project | python | wandb/sdk/internal/internal_api.py | 2,560 | 2,562 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,335 | push | def push(
self,
files: Union[List[str], Dict[str, IO]],
run: Optional[str] = None,
entity: Optional[str] = None,
project: Optional[str] = None,
description: Optional[str] = None,
force: bool = True,
progress: Union[TextIO, bool] = False,
) -> "List[Optional[requests.Response]]":
"""Uploads multiple files to W&B.
Arguments:
files (list or dict): The filenames to upload, when dict the values are open files
run (str, optional): The run to upload to
entity (str, optional): The entity to scope this project to. Defaults to wandb models
project (str, optional): The name of the project to upload to. Defaults to the one in settings.
description (str, optional): The description of the changes
force (bool, optional): Whether to prevent push if git has uncommitted changes
progress (callable, or stream): If callable, will be called with (chunk_bytes,
total_bytes) as argument else if True, renders a progress bar to stream.
Returns:
A list of `requests.Response` objects
"""
if project is None:
project = self.get_project()
if project is None:
raise CommError("No project configured.")
if run is None:
run = self.current_run_id
# TODO(adrian): we use a retriable version of self.upload_file() so
# will never retry self.upload_urls() here. Instead, maybe we should
# make push itself retriable.
run_id, upload_headers, result = self.upload_urls(
project, files, run, entity, description
)
extra_headers = {}
for upload_header in upload_headers:
key, val = upload_header.split(":", 1)
extra_headers[key] = val
responses = []
for file_name, file_info in result.items():
file_url = file_info["url"]
# If the upload URL is relative, fill it in with the base URL,
# since it's a proxied file store like the on-prem VM.
if file_url.startswith("/"):
file_url = f"{self.api_url}{file_url}"
try:
# To handle Windows paths
# TODO: this doesn't handle absolute paths...
normal_name = os.path.join(*file_name.split("/"))
open_file = (
files[file_name]
if isinstance(files, dict)
else open(normal_name, "rb")
)
except OSError:
print(f"{file_name} does not exist")
continue
if progress is False:
responses.append(
self.upload_file_retry(
file_info["url"], open_file, extra_headers=extra_headers
)
)
else:
if callable(progress):
responses.append( # type: ignore
self.upload_file_retry(
file_url, open_file, progress, extra_headers=extra_headers
)
)
else:
length = os.fstat(open_file.fileno()).st_size
with click.progressbar(
file=progress, # type: ignore
length=length,
label=f"Uploading file: {file_name}",
fill_char=click.style("&", fg="green"),
) as bar:
responses.append(
self.upload_file_retry(
file_url,
open_file,
lambda bites, _: bar.update(bites),
extra_headers=extra_headers,
)
)
open_file.close()
return responses | python | wandb/sdk/internal/internal_api.py | 2,565 | 2,658 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,336 | link_artifact | def link_artifact(
self,
client_id: str,
server_id: str,
portfolio_name: str,
entity: str,
project: str,
aliases: Sequence[str],
) -> Dict[str, Any]:
template = """
mutation LinkArtifact(
$artifactPortfolioName: String!,
$entityName: String!,
$projectName: String!,
$aliases: [ArtifactAliasInput!],
ID_TYPE
) {
linkArtifact(input: {
artifactPortfolioName: $artifactPortfolioName,
entityName: $entityName,
projectName: $projectName,
aliases: $aliases,
ID_VALUE
}) {
versionIndex
}
}
"""
def replace(a: str, b: str) -> None:
nonlocal template
template = template.replace(a, b)
if server_id:
replace("ID_TYPE", "$artifactID: ID")
replace("ID_VALUE", "artifactID: $artifactID")
elif client_id:
replace("ID_TYPE", "$clientID: ID")
replace("ID_VALUE", "clientID: $clientID")
variable_values = {
"clientID": client_id,
"artifactID": server_id,
"artifactPortfolioName": portfolio_name,
"entityName": entity,
"projectName": project,
"aliases": [
{"alias": alias, "artifactCollectionName": portfolio_name}
for alias in aliases
],
}
mutation = gql(template)
response = self.gql(mutation, variable_values=variable_values)
link_artifact: Dict[str, Any] = response["linkArtifact"]
return link_artifact | python | wandb/sdk/internal/internal_api.py | 2,660 | 2,715 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,337 | replace | def replace(a: str, b: str) -> None:
nonlocal template
template = template.replace(a, b) | python | wandb/sdk/internal/internal_api.py | 2,689 | 2,691 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,338 | use_artifact | def use_artifact(
self,
artifact_id: str,
entity_name: Optional[str] = None,
project_name: Optional[str] = None,
run_name: Optional[str] = None,
use_as: Optional[str] = None,
) -> Optional[Dict[str, Any]]:
query_template = """
mutation UseArtifact(
$entityName: String!,
$projectName: String!,
$runName: String!,
$artifactID: ID!,
_USED_AS_TYPE_
) {
useArtifact(input: {
entityName: $entityName,
projectName: $projectName,
runName: $runName,
artifactID: $artifactID,
_USED_AS_VALUE_
}) {
artifact {
id
digest
description
state
createdAt
labels
metadata
}
}
}
"""
artifact_types = self.server_use_artifact_input_introspection()
if "usedAs" in artifact_types:
query_template = query_template.replace(
"_USED_AS_TYPE_", "$usedAs: String"
).replace("_USED_AS_VALUE_", "usedAs: $usedAs")
else:
query_template = query_template.replace("_USED_AS_TYPE_", "").replace(
"_USED_AS_VALUE_", ""
)
query = gql(query_template)
entity_name = entity_name or self.settings("entity")
project_name = project_name or self.settings("project")
run_name = run_name or self.current_run_id
response = self.gql(
query,
variable_values={
"entityName": entity_name,
"projectName": project_name,
"runName": run_name,
"artifactID": artifact_id,
"usedAs": use_as,
},
)
if response["useArtifact"]["artifact"]:
artifact: Dict[str, Any] = response["useArtifact"]["artifact"]
return artifact
return None | python | wandb/sdk/internal/internal_api.py | 2,717 | 2,783 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,339 | create_artifact_type | def create_artifact_type(
self,
artifact_type_name: str,
entity_name: Optional[str] = None,
project_name: Optional[str] = None,
description: Optional[str] = None,
) -> Optional[str]:
mutation = gql(
"""
mutation CreateArtifactType(
$entityName: String!,
$projectName: String!,
$artifactTypeName: String!,
$description: String
) {
createArtifactType(input: {
entityName: $entityName,
projectName: $projectName,
name: $artifactTypeName,
description: $description
}) {
artifactType {
id
}
}
}
"""
)
entity_name = entity_name or self.settings("entity")
project_name = project_name or self.settings("project")
response = self.gql(
mutation,
variable_values={
"entityName": entity_name,
"projectName": project_name,
"artifactTypeName": artifact_type_name,
"description": description,
},
)
_id: Optional[str] = response["createArtifactType"]["artifactType"]["id"]
return _id | python | wandb/sdk/internal/internal_api.py | 2,785 | 2,825 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,340 | create_artifact | def create_artifact(
self,
artifact_type_name: str,
artifact_collection_name: str,
digest: str,
client_id: Optional[str] = None,
sequence_client_id: Optional[str] = None,
entity_name: Optional[str] = None,
project_name: Optional[str] = None,
run_name: Optional[str] = None,
description: Optional[str] = None,
labels: Optional[List[str]] = None,
metadata: Optional[Dict] = None,
aliases: Optional[List[Dict[str, str]]] = None,
distributed_id: Optional[str] = None,
is_user_created: Optional[bool] = False,
enable_digest_deduplication: Optional[bool] = False,
history_step: Optional[int] = None,
) -> Tuple[Dict, Dict]:
from pkg_resources import parse_version
_, server_info = self.viewer_server_info()
max_cli_version = server_info.get("cliVersionInfo", {}).get(
"max_cli_version", None
)
can_handle_client_id = max_cli_version is None or parse_version(
"0.11.0"
) <= parse_version(max_cli_version)
can_handle_dedupe = max_cli_version is None or parse_version(
"0.12.10"
) <= parse_version(max_cli_version)
can_handle_history = max_cli_version is None or parse_version(
"0.12.12"
) <= parse_version(max_cli_version)
mutation = gql(
"""
mutation CreateArtifact(
$artifactTypeName: String!,
$artifactCollectionNames: [String!],
$entityName: String!,
$projectName: String!,
$runName: String,
$description: String,
$digest: String!,
$labels: JSONString,
$aliases: [ArtifactAliasInput!],
$metadata: JSONString,
%s
%s
%s
%s
%s
) {
createArtifact(input: {
artifactTypeName: $artifactTypeName,
artifactCollectionNames: $artifactCollectionNames,
entityName: $entityName,
projectName: $projectName,
runName: $runName,
description: $description,
digest: $digest,
digestAlgorithm: MANIFEST_MD5,
labels: $labels,
aliases: $aliases,
metadata: $metadata,
%s
%s
%s
%s
%s
}) {
artifact {
id
digest
state
aliases {
artifactCollectionName
alias
}
artifactSequence {
id
latestArtifact {
id
versionIndex
}
}
}
}
}
"""
%
# For backwards compatibility with older backends that don't support
# distributed writers or digest deduplication.
(
"$historyStep: Int64!,"
if can_handle_history and history_step not in [0, None]
else "",
"$distributedID: String," if distributed_id else "",
"$clientID: ID!," if can_handle_client_id else "",
"$sequenceClientID: ID!," if can_handle_client_id else "",
"$enableDigestDeduplication: Boolean," if can_handle_dedupe else "",
# line sep
"historyStep: $historyStep,"
if can_handle_history and history_step not in [0, None]
else "",
"distributedID: $distributedID," if distributed_id else "",
"clientID: $clientID," if can_handle_client_id else "",
"sequenceClientID: $sequenceClientID," if can_handle_client_id else "",
"enableDigestDeduplication: $enableDigestDeduplication,"
if can_handle_dedupe
else "",
)
)
entity_name = entity_name or self.settings("entity")
project_name = project_name or self.settings("project")
if not is_user_created:
run_name = run_name or self.current_run_id
if aliases is None:
aliases = []
response = self.gql(
mutation,
variable_values={
"entityName": entity_name,
"projectName": project_name,
"runName": run_name,
"artifactTypeName": artifact_type_name,
"artifactCollectionNames": [artifact_collection_name],
"clientID": client_id,
"sequenceClientID": sequence_client_id,
"digest": digest,
"description": description,
"aliases": [alias for alias in aliases],
"labels": json.dumps(util.make_safe_for_json(labels))
if labels
else None,
"metadata": json.dumps(util.make_safe_for_json(metadata))
if metadata
else None,
"distributedID": distributed_id,
"enableDigestDeduplication": enable_digest_deduplication,
"historyStep": history_step,
},
)
av = response["createArtifact"]["artifact"]
# TODO: make this a part of the graph
av["version"] = "latest"
for alias in av["aliases"]:
if alias["artifactCollectionName"] == artifact_collection_name and re.match(
r"^v\d+$", alias["alias"]
):
av["version"] = alias["alias"]
latest = response["createArtifact"]["artifact"]["artifactSequence"].get(
"latestArtifact"
)
return av, latest | python | wandb/sdk/internal/internal_api.py | 2,827 | 2,984 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,341 | commit_artifact | def commit_artifact(self, artifact_id: str) -> "_Response":
mutation = gql(
"""
mutation CommitArtifact(
$artifactID: ID!,
) {
commitArtifact(input: {
artifactID: $artifactID,
}) {
artifact {
id
digest
}
}
}
"""
)
response: "_Response" = self.gql(
mutation,
variable_values={"artifactID": artifact_id},
timeout=60,
)
return response | python | wandb/sdk/internal/internal_api.py | 2,986 | 3,009 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,342 | create_artifact_manifest | def create_artifact_manifest(
self,
name: str,
digest: str,
artifact_id: Optional[str],
base_artifact_id: Optional[str] = None,
entity: Optional[str] = None,
project: Optional[str] = None,
run: Optional[str] = None,
include_upload: bool = True,
type: str = "FULL",
) -> Tuple[str, Dict[str, Any]]:
mutation = gql(
"""
mutation CreateArtifactManifest(
$name: String!,
$digest: String!,
$artifactID: ID!,
$baseArtifactID: ID,
$entityName: String!,
$projectName: String!,
$runName: String!,
$includeUpload: Boolean!,
%s
) {
createArtifactManifest(input: {
name: $name,
digest: $digest,
artifactID: $artifactID,
baseArtifactID: $baseArtifactID,
entityName: $entityName,
projectName: $projectName,
runName: $runName,
%s
}) {
artifactManifest {
id
file {
id
name
displayName
uploadUrl @include(if: $includeUpload)
uploadHeaders @include(if: $includeUpload)
}
}
}
}
"""
%
# For backwards compatibility with older backends that don't support
# patch manifests.
(
"$type: ArtifactManifestType = FULL" if type != "FULL" else "",
"type: $type" if type != "FULL" else "",
)
)
entity_name = entity or self.settings("entity")
project_name = project or self.settings("project")
run_name = run or self.current_run_id
response = self.gql(
mutation,
variable_values={
"name": name,
"digest": digest,
"artifactID": artifact_id,
"baseArtifactID": base_artifact_id,
"entityName": entity_name,
"projectName": project_name,
"runName": run_name,
"includeUpload": include_upload,
"type": type,
},
)
return (
response["createArtifactManifest"]["artifactManifest"]["id"],
response["createArtifactManifest"]["artifactManifest"]["file"],
) | python | wandb/sdk/internal/internal_api.py | 3,011 | 3,089 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,343 | update_artifact_manifest | def update_artifact_manifest(
self,
artifact_manifest_id: str,
base_artifact_id: Optional[str] = None,
digest: Optional[str] = None,
include_upload: Optional[bool] = True,
) -> Tuple[str, Dict[str, Any]]:
mutation = gql(
"""
mutation UpdateArtifactManifest(
$artifactManifestID: ID!,
$digest: String,
$baseArtifactID: ID,
$includeUpload: Boolean!,
) {
updateArtifactManifest(input: {
artifactManifestID: $artifactManifestID,
digest: $digest,
baseArtifactID: $baseArtifactID,
}) {
artifactManifest {
id
file {
id
name
displayName
uploadUrl @include(if: $includeUpload)
uploadHeaders @include(if: $includeUpload)
}
}
}
}
"""
)
response = self.gql(
mutation,
variable_values={
"artifactManifestID": artifact_manifest_id,
"digest": digest,
"baseArtifactID": base_artifact_id,
"includeUpload": include_upload,
},
)
return (
response["updateArtifactManifest"]["artifactManifest"]["id"],
response["updateArtifactManifest"]["artifactManifest"]["file"],
) | python | wandb/sdk/internal/internal_api.py | 3,091 | 3,139 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,344 | _resolve_client_id | def _resolve_client_id(
self,
client_id: str,
) -> Optional[str]:
if client_id in self._client_id_mapping:
return self._client_id_mapping[client_id]
query = gql(
"""
query ClientIDMapping($clientID: ID!) {
clientIDMapping(clientID: $clientID) {
serverID
}
}
"""
)
response = self.gql(
query,
variable_values={
"clientID": client_id,
},
)
server_id = None
if response is not None:
client_id_mapping = response.get("clientIDMapping")
if client_id_mapping is not None:
server_id = client_id_mapping.get("serverID")
if server_id is not None:
self._client_id_mapping[client_id] = server_id
return server_id | python | wandb/sdk/internal/internal_api.py | 3,141 | 3,170 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,345 | create_artifact_files | def create_artifact_files(
self, artifact_files: Iterable["CreateArtifactFileSpecInput"]
) -> Mapping[str, "CreateArtifactFilesResponseFile"]:
mutation = gql(
"""
mutation CreateArtifactFiles(
$storageLayout: ArtifactStorageLayout!
$artifactFiles: [CreateArtifactFileSpecInput!]!
) {
createArtifactFiles(input: {
artifactFiles: $artifactFiles,
storageLayout: $storageLayout
}) {
files {
edges {
node {
id
name
displayName
uploadUrl
uploadHeaders
artifact {
id
}
}
}
}
}
}
"""
)
# TODO: we should use constants here from interface/artifacts.py
# but probably don't want the dependency. We're going to remove
# this setting in a future release, so I'm just hard-coding the strings.
storage_layout = "V2"
if env.get_use_v1_artifacts():
storage_layout = "V1"
response = self.gql(
mutation,
variable_values={
"storageLayout": storage_layout,
"artifactFiles": [af for af in artifact_files],
},
)
result = {}
for edge in response["createArtifactFiles"]["files"]["edges"]:
node = edge["node"]
result[node["displayName"]] = node
return result | python | wandb/sdk/internal/internal_api.py | 3,173 | 3,224 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,346 | notify_scriptable_run_alert | def notify_scriptable_run_alert(
self,
title: str,
text: str,
level: Optional[str] = None,
wait_duration: Optional["Number"] = None,
) -> bool:
mutation = gql(
"""
mutation NotifyScriptableRunAlert(
$entityName: String!,
$projectName: String!,
$runName: String!,
$title: String!,
$text: String!,
$severity: AlertSeverity = INFO,
$waitDuration: Duration
) {
notifyScriptableRunAlert(input: {
entityName: $entityName,
projectName: $projectName,
runName: $runName,
title: $title,
text: $text,
severity: $severity,
waitDuration: $waitDuration
}) {
success
}
}
"""
)
response = self.gql(
mutation,
variable_values={
"entityName": self.settings("entity"),
"projectName": self.settings("project"),
"runName": self.current_run_id,
"title": title,
"text": text,
"severity": level,
"waitDuration": wait_duration,
},
)
success: bool = response["notifyScriptableRunAlert"]["success"]
return success | python | wandb/sdk/internal/internal_api.py | 3,227 | 3,273 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,347 | get_sweep_state | def get_sweep_state(
self, sweep: str, entity: Optional[str] = None, project: Optional[str] = None
) -> "SweepState":
state: "SweepState" = self.sweep(
sweep=sweep, entity=entity, project=project, specs="{}"
)["state"]
return state | python | wandb/sdk/internal/internal_api.py | 3,275 | 3,281 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,348 | set_sweep_state | def set_sweep_state(
self,
sweep: str,
state: "SweepState",
entity: Optional[str] = None,
project: Optional[str] = None,
) -> None:
assert state in ("RUNNING", "PAUSED", "CANCELED", "FINISHED")
s = self.sweep(sweep=sweep, entity=entity, project=project, specs="{}")
curr_state = s["state"].upper()
if state == "RUNNING" and curr_state in ("CANCELED", "FINISHED"):
raise Exception("Cannot resume %s sweep." % curr_state.lower())
elif state == "PAUSED" and curr_state not in ("PAUSED", "RUNNING"):
raise Exception("Cannot pause %s sweep." % curr_state.lower())
elif curr_state not in ("RUNNING", "PAUSED"):
raise Exception("Sweep already %s." % curr_state.lower())
sweep_id = s["id"]
mutation = gql(
"""
mutation UpsertSweep(
$id: ID,
$state: String,
$entityName: String,
$projectName: String
) {
upsertSweep(input: {
id: $id,
state: $state,
entityName: $entityName,
projectName: $projectName
}){
sweep {
name
}
}
}
"""
)
self.gql(
mutation,
variable_values={
"id": sweep_id,
"state": state,
"entityName": entity or self.settings("entity"),
"projectName": project or self.settings("project"),
},
) | python | wandb/sdk/internal/internal_api.py | 3,283 | 3,329 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,349 | stop_sweep | def stop_sweep(
self,
sweep: str,
entity: Optional[str] = None,
project: Optional[str] = None,
) -> None:
"""Finish the sweep to stop running new runs and let currently running runs finish."""
self.set_sweep_state(
sweep=sweep, state="FINISHED", entity=entity, project=project
) | python | wandb/sdk/internal/internal_api.py | 3,331 | 3,340 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,350 | cancel_sweep | def cancel_sweep(
self,
sweep: str,
entity: Optional[str] = None,
project: Optional[str] = None,
) -> None:
"""Cancel the sweep to kill all running runs and stop running new runs."""
self.set_sweep_state(
sweep=sweep, state="CANCELED", entity=entity, project=project
) | python | wandb/sdk/internal/internal_api.py | 3,342 | 3,351 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,351 | pause_sweep | def pause_sweep(
self,
sweep: str,
entity: Optional[str] = None,
project: Optional[str] = None,
) -> None:
"""Pause the sweep to temporarily stop running new runs."""
self.set_sweep_state(
sweep=sweep, state="PAUSED", entity=entity, project=project
) | python | wandb/sdk/internal/internal_api.py | 3,353 | 3,362 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,352 | resume_sweep | def resume_sweep(
self,
sweep: str,
entity: Optional[str] = None,
project: Optional[str] = None,
) -> None:
"""Resume the sweep to continue running new runs."""
self.set_sweep_state(
sweep=sweep, state="RUNNING", entity=entity, project=project
) | python | wandb/sdk/internal/internal_api.py | 3,364 | 3,373 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,353 | _status_request | def _status_request(self, url: str, length: int) -> requests.Response:
"""Ask google how much we've uploaded."""
return requests.put(
url=url,
headers={"Content-Length": "0", "Content-Range": "bytes */%i" % length},
) | python | wandb/sdk/internal/internal_api.py | 3,375 | 3,380 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,354 | _flatten_edges | def _flatten_edges(self, response: "_Response") -> List[Dict]:
"""Return an array from the nested graphql relay structure."""
return [node["node"] for node in response["edges"]] | python | wandb/sdk/internal/internal_api.py | 3,382 | 3,384 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,355 | _dict_nested_set | def _dict_nested_set(target: Dict[str, Any], key_list: Sequence[str], v: Any) -> None:
# recurse down the dictionary structure:
for k in key_list[:-1]:
target.setdefault(k, {})
new_target = target.get(k)
if TYPE_CHECKING:
new_target = cast(Dict[str, Any], new_target)
target = new_target
# use the last element of the key to write the leaf:
target[key_list[-1]] = v | python | wandb/sdk/internal/handler.py | 51 | 61 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,356 | __init__ | def __init__(
self,
settings: SettingsStatic,
record_q: "Queue[Record]",
result_q: "Queue[Result]",
stopped: Event,
writer_q: "Queue[Record]",
interface: InterfaceQueue,
context_keeper: context.ContextKeeper,
) -> None:
self._settings = settings
self._record_q = record_q
self._result_q = result_q
self._stopped = stopped
self._writer_q = writer_q
self._interface = interface
self._context_keeper = context_keeper
self._tb_watcher = None
self._system_monitor = None
self._step = 0
self._track_time = None
self._accumulate_time = 0
self._run_start_time = None
# keep track of summary from key/val updates
self._consolidated_summary = dict()
self._sampled_history = defaultdict(sample.UniformSampleAccumulator)
self._run_proto = None
self._partial_history = dict()
self._metric_defines = defaultdict(MetricRecord)
self._metric_globs = defaultdict(MetricRecord)
self._metric_track = dict()
self._metric_copy = dict()
# TODO: implement release protocol to clean this up
self._artifact_xid_done = dict() | python | wandb/sdk/internal/handler.py | 87 | 124 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,357 | __len__ | def __len__(self) -> int:
return self._record_q.qsize() | python | wandb/sdk/internal/handler.py | 126 | 127 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,358 | handle | def handle(self, record: Record) -> None:
self._context_keeper.add_from_record(record)
record_type = record.WhichOneof("record_type")
assert record_type
handler_str = "handle_" + record_type
handler: Callable[[Record], None] = getattr(self, handler_str, None) # type: ignore
assert handler, f"unknown handle: {handler_str}" # type: ignore
handler(record) | python | wandb/sdk/internal/handler.py | 129 | 136 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,359 | handle_request | def handle_request(self, record: Record) -> None:
request_type = record.request.WhichOneof("request_type")
assert request_type
handler_str = "handle_request_" + request_type
handler: Callable[[Record], None] = getattr(self, handler_str, None) # type: ignore
if request_type != "network_status":
logger.debug(f"handle_request: {request_type}")
assert handler, f"unknown handle: {handler_str}" # type: ignore
handler(record) | python | wandb/sdk/internal/handler.py | 138 | 146 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,360 | _dispatch_record | def _dispatch_record(self, record: Record, always_send: bool = False) -> None:
if always_send:
record.control.always_send = True
tracelog.log_message_queue(record, self._writer_q)
self._writer_q.put(record) | python | wandb/sdk/internal/handler.py | 148 | 152 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,361 | _respond_result | def _respond_result(self, result: Result) -> None:
tracelog.log_message_queue(result, self._result_q)
context_id = context.context_id_from_result(result)
self._context_keeper.release(context_id)
self._result_q.put(result) | python | wandb/sdk/internal/handler.py | 154 | 158 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,362 | debounce | def debounce(self) -> None:
pass | python | wandb/sdk/internal/handler.py | 160 | 161 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,363 | handle_request_cancel | def handle_request_cancel(self, record: Record) -> None:
self._dispatch_record(record) | python | wandb/sdk/internal/handler.py | 163 | 164 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,364 | handle_request_defer | def handle_request_defer(self, record: Record) -> None:
defer = record.request.defer
state = defer.state
logger.info(f"handle defer: {state}")
# only handle flush tb (sender handles the rest)
if state == defer.FLUSH_STATS:
# TODO(jhr): this could block so we dont really want to call shutdown
# from handler thread
if self._system_monitor is not None:
self._system_monitor.finish()
elif state == defer.FLUSH_TB:
if self._tb_watcher:
# shutdown tensorboard workers so we get all metrics flushed
self._tb_watcher.finish()
self._tb_watcher = None
elif state == defer.FLUSH_PARTIAL_HISTORY:
self._flush_partial_history()
elif state == defer.FLUSH_SUM:
self._save_summary(self._consolidated_summary, flush=True)
# defer is used to drive the sender finish state machine
self._dispatch_record(record, always_send=True) | python | wandb/sdk/internal/handler.py | 166 | 188 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,365 | handle_request_login | def handle_request_login(self, record: Record) -> None:
self._dispatch_record(record) | python | wandb/sdk/internal/handler.py | 190 | 191 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,366 | handle_run | def handle_run(self, record: Record) -> None:
self._dispatch_record(record) | python | wandb/sdk/internal/handler.py | 193 | 194 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,367 | handle_stats | def handle_stats(self, record: Record) -> None:
self._dispatch_record(record) | python | wandb/sdk/internal/handler.py | 196 | 197 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,368 | handle_config | def handle_config(self, record: Record) -> None:
self._dispatch_record(record) | python | wandb/sdk/internal/handler.py | 199 | 200 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,369 | handle_output | def handle_output(self, record: Record) -> None:
self._dispatch_record(record) | python | wandb/sdk/internal/handler.py | 202 | 203 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,370 | handle_output_raw | def handle_output_raw(self, record: Record) -> None:
self._dispatch_record(record) | python | wandb/sdk/internal/handler.py | 205 | 206 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,371 | handle_files | def handle_files(self, record: Record) -> None:
self._dispatch_record(record) | python | wandb/sdk/internal/handler.py | 208 | 209 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,372 | handle_link_artifact | def handle_link_artifact(self, record: Record) -> None:
self._dispatch_record(record) | python | wandb/sdk/internal/handler.py | 211 | 212 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,373 | handle_use_artifact | def handle_use_artifact(self, record: Record) -> None:
self._dispatch_record(record) | python | wandb/sdk/internal/handler.py | 214 | 215 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,374 | handle_artifact | def handle_artifact(self, record: Record) -> None:
self._dispatch_record(record) | python | wandb/sdk/internal/handler.py | 217 | 218 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,375 | handle_alert | def handle_alert(self, record: Record) -> None:
self._dispatch_record(record) | python | wandb/sdk/internal/handler.py | 220 | 221 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,376 | _save_summary | def _save_summary(self, summary_dict: SummaryDict, flush: bool = False) -> None:
summary = SummaryRecord()
for k, v in summary_dict.items():
update = summary.update.add()
update.key = k
update.value_json = json.dumps(v)
if flush:
record = Record(summary=summary)
self._dispatch_record(record)
elif not self._settings._offline:
# Send this summary update as a request since we aren't persisting every update
summary_record = SummaryRecordRequest(summary=summary)
request_record = self._interface._make_request(
summary_record=summary_record
)
self._dispatch_record(request_record) | python | wandb/sdk/internal/handler.py | 223 | 238 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,377 | _save_history | def _save_history(
self,
history: HistoryRecord,
) -> None:
for item in history.item:
# TODO(jhr) save nested keys?
k = item.key
v = json.loads(item.value_json)
if isinstance(v, numbers.Real):
self._sampled_history[k].add(v) | python | wandb/sdk/internal/handler.py | 240 | 249 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,378 | _update_summary_metrics | def _update_summary_metrics(
self,
s: "MetricSummary",
kl: List[str],
v: "numbers.Real",
float_v: float,
goal_max: Optional[bool],
) -> bool:
updated = False
best_key: Optional[Tuple[str, ...]] = None
if s.none:
return False
if s.copy:
# non key list copy already done in _update_summary
if len(kl) > 1:
_dict_nested_set(self._consolidated_summary, kl, v)
return True
if s.last:
last_key = tuple(kl + ["last"])
old_last = self._metric_track.get(last_key)
if old_last is None or float_v != old_last:
self._metric_track[last_key] = float_v
_dict_nested_set(self._consolidated_summary, last_key, v)
updated = True
if s.best:
best_key = tuple(kl + ["best"])
if s.max or best_key and goal_max:
max_key = tuple(kl + ["max"])
old_max = self._metric_track.get(max_key)
if old_max is None or float_v > old_max:
self._metric_track[max_key] = float_v
if s.max:
_dict_nested_set(self._consolidated_summary, max_key, v)
updated = True
if best_key:
_dict_nested_set(self._consolidated_summary, best_key, v)
updated = True
# defaulting to minimize if goal is not supecified
if s.min or best_key and not goal_max:
min_key = tuple(kl + ["min"])
old_min = self._metric_track.get(min_key)
if old_min is None or float_v < old_min:
self._metric_track[min_key] = float_v
if s.min:
_dict_nested_set(self._consolidated_summary, min_key, v)
updated = True
if best_key:
_dict_nested_set(self._consolidated_summary, best_key, v)
updated = True
if s.mean:
tot_key = tuple(kl + ["tot"])
num_key = tuple(kl + ["num"])
avg_key = tuple(kl + ["mean"])
tot = self._metric_track.get(tot_key, 0.0)
num = self._metric_track.get(num_key, 0)
tot += float_v
num += 1
self._metric_track[tot_key] = tot
self._metric_track[num_key] = num
_dict_nested_set(self._consolidated_summary, avg_key, tot / num)
updated = True
return updated | python | wandb/sdk/internal/handler.py | 251 | 312 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,379 | _update_summary_leaf | def _update_summary_leaf(
self,
kl: List[str],
v: Any,
d: Optional[MetricRecord] = None,
) -> bool:
has_summary = d and d.HasField("summary")
if len(kl) == 1:
copy_key = tuple(kl)
old_copy = self._metric_copy.get(copy_key)
if old_copy is None or v != old_copy:
self._metric_copy[copy_key] = v
# Store copy metric if not specified, or copy behavior
if not has_summary or (d and d.summary.copy):
self._consolidated_summary[kl[0]] = v
return True
if not d:
return False
if not has_summary:
return False
if not isinstance(v, numbers.Real):
return False
if math.isnan(v):
return False
float_v = float(v)
goal_max = None
if d.goal:
goal_max = d.goal == d.GOAL_MAXIMIZE
if self._update_summary_metrics(
d.summary, kl=kl, v=v, float_v=float_v, goal_max=goal_max
):
return True
return False | python | wandb/sdk/internal/handler.py | 314 | 346 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,380 | _update_summary_list | def _update_summary_list(
self,
kl: List[str],
v: Any,
d: Optional[MetricRecord] = None,
) -> bool:
metric_key = ".".join([k.replace(".", "\\.") for k in kl])
d = self._metric_defines.get(metric_key, d)
# if the dict has _type key, it's a wandb table object
if isinstance(v, dict) and not handler_util.metric_is_wandb_dict(v):
updated = False
for nk, nv in v.items():
if self._update_summary_list(kl=kl[:] + [nk], v=nv, d=d):
updated = True
return updated
# If the dict is a media object, update the pointer to the latest alias
elif isinstance(v, dict) and handler_util.metric_is_wandb_dict(v):
if "_latest_artifact_path" in v and "artifact_path" in v:
# TODO: Make non-destructive?
v["artifact_path"] = v["_latest_artifact_path"]
updated = self._update_summary_leaf(kl=kl, v=v, d=d)
return updated | python | wandb/sdk/internal/handler.py | 348 | 369 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,381 | _update_summary_media_objects | def _update_summary_media_objects(self, v: Dict[str, Any]) -> Dict[str, Any]:
# For now, non-recursive - just top level
for nk, nv in v.items():
if (
isinstance(nv, dict)
and handler_util.metric_is_wandb_dict(nv)
and "_latest_artifact_path" in nv
and "artifact_path" in nv
):
# TODO: Make non-destructive?
nv["artifact_path"] = nv["_latest_artifact_path"]
v[nk] = nv
return v | python | wandb/sdk/internal/handler.py | 371 | 383 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,382 | _update_summary | def _update_summary(self, history_dict: Dict[str, Any]) -> List[str]:
# keep old behavior fast path if no define metrics have been used
if not self._metric_defines:
history_dict = self._update_summary_media_objects(history_dict)
self._consolidated_summary.update(history_dict)
return list(history_dict.keys())
updated_keys = []
for k, v in history_dict.items():
if self._update_summary_list(kl=[k], v=v):
updated_keys.append(k)
return updated_keys | python | wandb/sdk/internal/handler.py | 385 | 395 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,383 | _history_assign_step | def _history_assign_step(
self,
history: HistoryRecord,
history_dict: Dict[str, Any],
) -> None:
has_step = history.HasField("step")
item = history.item.add()
item.key = "_step"
if has_step:
step = history.step.num
history_dict["_step"] = step
item.value_json = json.dumps(step)
self._step = step + 1
else:
history_dict["_step"] = self._step
item.value_json = json.dumps(self._step)
self._step += 1 | python | wandb/sdk/internal/handler.py | 397 | 413 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,384 | _history_define_metric | def _history_define_metric(self, hkey: str) -> Optional[MetricRecord]:
"""Check for hkey match in glob metrics and return the defined metric."""
# Dont define metric for internal metrics
if hkey.startswith("_"):
return None
for k, mglob in self._metric_globs.items():
if k.endswith("*"):
if hkey.startswith(k[:-1]):
m = MetricRecord()
m.CopyFrom(mglob)
m.ClearField("glob_name")
m.options.defined = False
m.name = hkey
return m
return None | python | wandb/sdk/internal/handler.py | 415 | 429 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,385 | _history_update_leaf | def _history_update_leaf(
self,
kl: List[str],
v: Any,
history_dict: Dict[str, Any],
update_history: Dict[str, Any],
) -> None:
hkey = ".".join([k.replace(".", "\\.") for k in kl])
m = self._metric_defines.get(hkey)
if not m:
m = self._history_define_metric(hkey)
if not m:
return
mr = Record()
mr.metric.CopyFrom(m)
mr.control.local = True # Dont store this, just send it
self._handle_defined_metric(mr)
if m.options.step_sync and m.step_metric:
if m.step_metric not in history_dict:
copy_key = tuple([m.step_metric])
step = self._metric_copy.get(copy_key)
if step is not None:
update_history[m.step_metric] = step | python | wandb/sdk/internal/handler.py | 431 | 454 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,386 | _history_update_list | def _history_update_list(
self,
kl: List[str],
v: Any,
history_dict: Dict[str, Any],
update_history: Dict[str, Any],
) -> None:
if isinstance(v, dict):
for nk, nv in v.items():
self._history_update_list(
kl=kl[:] + [nk],
v=nv,
history_dict=history_dict,
update_history=update_history,
)
return
self._history_update_leaf(
kl=kl, v=v, history_dict=history_dict, update_history=update_history
) | python | wandb/sdk/internal/handler.py | 456 | 474 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,387 | _history_update | def _history_update(
self,
history: HistoryRecord,
history_dict: Dict[str, Any],
) -> None:
# if syncing an old run, we can skip this logic
if history_dict.get("_step") is None:
self._history_assign_step(history, history_dict)
update_history: Dict[str, Any] = {}
# Look for metric matches
if self._metric_defines or self._metric_globs:
for hkey, hval in history_dict.items():
self._history_update_list([hkey], hval, history_dict, update_history)
if update_history:
history_dict.update(update_history)
for k, v in update_history.items():
item = history.item.add()
item.key = k
item.value_json = json.dumps(v) | python | wandb/sdk/internal/handler.py | 476 | 496 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,388 | handle_history | def handle_history(self, record: Record) -> None:
history_dict = proto_util.dict_from_proto_list(record.history.item)
# Inject _runtime if it is not present
if history_dict is not None:
if "_runtime" not in history_dict:
self._history_assign_runtime(record.history, history_dict)
self._history_update(record.history, history_dict)
self._dispatch_record(record)
self._save_history(record.history)
updated_keys = self._update_summary(history_dict)
if updated_keys:
updated_items = {k: self._consolidated_summary[k] for k in updated_keys}
self._save_summary(updated_items) | python | wandb/sdk/internal/handler.py | 498 | 512 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,389 | _flush_partial_history | def _flush_partial_history(
self,
step: Optional[int] = None,
) -> None:
if not self._partial_history:
return
history = HistoryRecord()
for k, v in self._partial_history.items():
item = history.item.add()
item.key = k
item.value_json = json.dumps(v)
if step is not None:
history.step.num = step
self.handle_history(Record(history=history))
self._partial_history = {} | python | wandb/sdk/internal/handler.py | 514 | 529 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,390 | handle_request_sender_mark_report | def handle_request_sender_mark_report(self, record: Record) -> None:
self._dispatch_record(record, always_send=True) | python | wandb/sdk/internal/handler.py | 531 | 532 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,391 | handle_request_status_report | def handle_request_status_report(self, record: Record) -> None:
self._dispatch_record(record, always_send=True) | python | wandb/sdk/internal/handler.py | 534 | 535 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,392 | handle_request_partial_history | def handle_request_partial_history(self, record: Record) -> None:
partial_history = record.request.partial_history
flush = None
if partial_history.HasField("action"):
flush = partial_history.action.flush
step = None
if partial_history.HasField("step"):
step = partial_history.step.num
history_dict = proto_util.dict_from_proto_list(partial_history.item)
if step is not None:
if step < self._step:
logger.warning(
f"Step {step} < {self._step}. Dropping entry: {history_dict}."
)
return
elif step > self._step:
self._flush_partial_history()
self._step = step
elif flush is None:
flush = True
self._partial_history.update(history_dict)
if flush:
self._flush_partial_history(self._step) | python | wandb/sdk/internal/handler.py | 537 | 564 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,393 | handle_summary | def handle_summary(self, record: Record) -> None:
summary = record.summary
for item in summary.update:
if len(item.nested_key) > 0:
# we use either key or nested_key -- not both
assert item.key == ""
key = tuple(item.nested_key)
else:
# no counter-assertion here, because technically
# summary[""] is valid
key = (item.key,)
target = self._consolidated_summary
# recurse down the dictionary structure:
for prop in key[:-1]:
target = target[prop]
# use the last element of the key to write the leaf:
target[key[-1]] = json.loads(item.value_json)
for item in summary.remove:
if len(item.nested_key) > 0:
# we use either key or nested_key -- not both
assert item.key == ""
key = tuple(item.nested_key)
else:
# no counter-assertion here, because technically
# summary[""] is valid
key = (item.key,)
target = self._consolidated_summary
# recurse down the dictionary structure:
for prop in key[:-1]:
target = target[prop]
# use the last element of the key to erase the leaf:
del target[key[-1]]
self._save_summary(self._consolidated_summary) | python | wandb/sdk/internal/handler.py | 566 | 606 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,394 | handle_exit | def handle_exit(self, record: Record) -> None:
if self._track_time is not None:
self._accumulate_time += time.time() - self._track_time
record.exit.runtime = int(self._accumulate_time)
self._dispatch_record(record, always_send=True) | python | wandb/sdk/internal/handler.py | 608 | 612 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,395 | handle_final | def handle_final(self, record: Record) -> None:
self._dispatch_record(record, always_send=True) | python | wandb/sdk/internal/handler.py | 614 | 615 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,396 | handle_preempting | def handle_preempting(self, record: Record) -> None:
self._dispatch_record(record) | python | wandb/sdk/internal/handler.py | 617 | 618 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,397 | handle_header | def handle_header(self, record: Record) -> None:
self._dispatch_record(record) | python | wandb/sdk/internal/handler.py | 620 | 621 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,398 | handle_footer | def handle_footer(self, record: Record) -> None:
self._dispatch_record(record) | python | wandb/sdk/internal/handler.py | 623 | 624 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,399 | handle_request_check_version | def handle_request_check_version(self, record: Record) -> None:
self._dispatch_record(record) | python | wandb/sdk/internal/handler.py | 626 | 627 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,400 | handle_request_attach | def handle_request_attach(self, record: Record) -> None:
self._dispatch_record(record) | python | wandb/sdk/internal/handler.py | 629 | 630 | {
"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.