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,101
get_base_setup
def get_base_setup( launch_project: LaunchProject, py_version: str, py_major: str ) -> str: """Fill in the Dockerfile templates for stage 2 of build. CPU version is built on python, GPU version is built on nvidia:cuda. """ python_base_image = f"python:{py_version}-buster" if launch_project.cuda...
python
wandb/sdk/launch/builder/build.py
188
224
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,102
get_env_vars_dict
def get_env_vars_dict(launch_project: LaunchProject, api: Api) -> Dict[str, str]: """Generate environment variables for the project. Arguments: launch_project: LaunchProject to generate environment variables for. Returns: Dictionary of environment variables. """ env_vars = {} env_v...
python
wandb/sdk/launch/builder/build.py
227
270
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,103
get_requirements_section
def get_requirements_section(launch_project: LaunchProject, builder_type: str) -> str: if builder_type == "docker": buildx_installed = docker.is_buildx_installed() if not buildx_installed: wandb.termwarn( "Docker BuildX is not installed, for faster builds upgrade docker: ...
python
wandb/sdk/launch/builder/build.py
273
317
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,104
get_user_setup
def get_user_setup(username: str, userid: int, runner_type: str) -> str: if runner_type == "sagemaker": # sagemaker must run as root return "USER root" user_create = USER_CREATE_TEMPLATE.format(uid=userid, user=username) user_create += f"\nUSER {username}" return user_create
python
wandb/sdk/launch/builder/build.py
320
326
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,105
get_entrypoint_setup
def get_entrypoint_setup( launch_project: LaunchProject, entry_point: EntryPoint, workdir: str, ) -> str: # this check will always pass, since this is only called in the build case where # the project_dir is set assert launch_project.project_dir is not None with open(os.path.join(launch_proj...
python
wandb/sdk/launch/builder/build.py
329
343
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,106
generate_dockerfile
def generate_dockerfile( launch_project: LaunchProject, entry_point: EntryPoint, runner_type: str, builder_type: str, ) -> str: # get python versions truncated to major.minor to ensure image availability if launch_project.python_version: spl = launch_project.python_version.split(".")[:2]...
python
wandb/sdk/launch/builder/build.py
346
391
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,107
construct_gcp_registry_uri
def construct_gcp_registry_uri( gcp_repo: str, gcp_project: str, gcp_registry: str ) -> str: return "/".join([gcp_registry, gcp_project, gcp_repo])
python
wandb/sdk/launch/builder/build.py
394
397
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,108
_parse_existing_requirements
def _parse_existing_requirements(launch_project: LaunchProject) -> str: requirements_line = "" assert launch_project.project_dir is not None base_requirements = os.path.join(launch_project.project_dir, "requirements.txt") if os.path.exists(base_requirements): include_only = set() with op...
python
wandb/sdk/launch/builder/build.py
400
424
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,109
_create_docker_build_ctx
def _create_docker_build_ctx( launch_project: LaunchProject, dockerfile_contents: str, ) -> str: """Create a build context temp dir for a Dockerfile and project code.""" directory = tempfile.mkdtemp() dst_path = os.path.join(directory, "src") assert launch_project.project_dir is not None shu...
python
wandb/sdk/launch/builder/build.py
427
454
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,110
join
def join(split_command: List[str]) -> str: """Return a shell-escaped string from *split_command*. Also remove quotes from double quoted strings. Ex: "'local container queue'" --> "local container queue" """ return " ".join(shlex.quote(arg.replace("'", "")) for arg in split_command)
python
wandb/sdk/launch/builder/build.py
457
463
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,111
construct_builder_args
def construct_builder_args( launch_config: Optional[Dict] = None, build_config: Optional[Dict] = None, ) -> Tuple[Dict[str, Any], Dict[str, Any]]: registry_config = None if launch_config is not None: build_config = launch_config.get("builder") registry_config = launch_config.get("registr...
python
wandb/sdk/launch/builder/build.py
466
484
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,112
build_image_with_builder
def build_image_with_builder( builder: AbstractBuilder, launch_project: LaunchProject, entry_point: EntryPoint, ) -> Optional[str]: """Build image with testing and logging.""" wandb.termlog(f"{LOG_PREFIX}Building docker image from uri source") image_uri: Optional[str] = builder.build_image( ...
python
wandb/sdk/launch/builder/build.py
487
498
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,113
build_image_from_project
def build_image_from_project( launch_project: LaunchProject, api: Api, launch_config: Dict[str, Any], ) -> str: """Construct a docker image from a project and returns the URI of the image. Arguments: launch_project: The project to build an image from. api: The API object to use for ...
python
wandb/sdk/launch/builder/build.py
501
559
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,114
image_tag_from_dockerfile_and_source
def image_tag_from_dockerfile_and_source( launch_project: LaunchProject, dockerfile_contents: str ) -> str: """Hashes the source and dockerfile contents into a unique tag.""" image_source_string = launch_project.get_image_source_string() unique_id_string = image_source_string + dockerfile_contents i...
python
wandb/sdk/launch/builder/build.py
562
569
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,115
_wait_for_completion
def _wait_for_completion( batch_client: client.BatchV1Api, job_name: str, deadline_secs: Optional[int] = None ) -> bool: start_time = time.time() while True: job = batch_client.read_namespaced_job_status(job_name, "wandb") if job.status.succeeded is not None and job.status.succeeded >= 1: ...
python
wandb/sdk/launch/builder/kaniko_builder.py
51
66
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,116
__init__
def __init__( self, environment: AbstractEnvironment, registry: AbstractRegistry, build_job_name: str = "wandb-launch-container-build", build_context_store: str = "", secret_name: str = "", secret_key: str = "", verify: bool = True, ): """Initi...
python
wandb/sdk/launch/builder/kaniko_builder.py
79
114
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,117
from_config
def from_config( cls, config: dict, environment: AbstractEnvironment, registry: AbstractRegistry, verify: bool = True, login: bool = True, ) -> "AbstractBuilder": """Create a KanikoBuilder from a config dict. Arguments: config: A dict cont...
python
wandb/sdk/launch/builder/kaniko_builder.py
117
159
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,118
verify
def verify(self) -> None: """Verify that the builder config is valid. Raises: LaunchError: If the builder config is invalid. """ if self.environment is None: raise LaunchError("No environment specified for Kaniko build.") self.environment.verify_storage_u...
python
wandb/sdk/launch/builder/kaniko_builder.py
161
169
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,119
login
def login(self) -> None: """Login to the registry.""" pass
python
wandb/sdk/launch/builder/kaniko_builder.py
171
173
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,120
_create_docker_ecr_config_map
def _create_docker_ecr_config_map( self, job_name: str, corev1_client: client.CoreV1Api, repository: str ) -> None: if self.registry is None: raise LaunchError("No registry specified for Kaniko build.") username, password = self.registry.get_username_password() encoded = ...
python
wandb/sdk/launch/builder/kaniko_builder.py
175
196
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,121
_delete_docker_ecr_config_map
def _delete_docker_ecr_config_map( self, job_name: str, client: client.CoreV1Api ) -> None: if self.secret_name: client.delete_namespaced_config_map(f"docker-config-{job_name}", "wandb")
python
wandb/sdk/launch/builder/kaniko_builder.py
198
202
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,122
_upload_build_context
def _upload_build_context(self, run_id: str, context_path: str) -> str: # creat a tar archive of the build context and upload it to s3 context_file = tempfile.NamedTemporaryFile(delete=False) with tarfile.TarFile.open(fileobj=context_file, mode="w:gz") as context_tgz: context_tgz.add...
python
wandb/sdk/launch/builder/kaniko_builder.py
204
214
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,123
build_image
def build_image( self, launch_project: LaunchProject, entrypoint: EntryPoint, ) -> str: # TODO: this should probably throw an error if the registry is a local registry if not self.registry: raise LaunchError("No registry specified for Kaniko build.") # kan...
python
wandb/sdk/launch/builder/kaniko_builder.py
216
304
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,124
_create_kaniko_job
def _create_kaniko_job( self, job_name: str, repository: str, image_tag: str, build_context_path: str, ) -> "client.V1Job": env = [] volume_mounts = [] volumes = [] if bool(self.secret_name) != bool(self.secret_key): raise LaunchErr...
python
wandb/sdk/launch/builder/kaniko_builder.py
306
419
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,125
__init__
def __init__( self, environment: AbstractEnvironment, registry: AbstractRegistry, verify: bool = True, login: bool = True, ): """Initialize a DockerBuilder. Arguments: environment (AbstractEnvironment): The environment to use. registry...
python
wandb/sdk/launch/builder/docker_builder.py
49
72
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,126
from_config
def from_config( cls, config: Dict[str, Any], environment: AbstractEnvironment, registry: AbstractRegistry, verify: bool = True, ) -> "DockerBuilder": """Create a DockerBuilder from a config. Arguments: config (Dict[str, Any]): The config. ...
python
wandb/sdk/launch/builder/docker_builder.py
75
95
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,127
verify
def verify(self) -> None: """Verify the builder.""" validate_docker_installation()
python
wandb/sdk/launch/builder/docker_builder.py
97
99
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,128
login
def login(self) -> None: """Login to the registry.""" if isinstance(self.registry, LocalRegistry): _logger.info(f"{LOG_PREFIX}No registry configured, skipping login.") else: username, password = self.registry.get_username_password() docker.login(username, pass...
python
wandb/sdk/launch/builder/docker_builder.py
101
107
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,129
build_image
def build_image( self, launch_project: LaunchProject, entrypoint: EntryPoint, ) -> str: """Build the image for the given project. Arguments: launch_project (LaunchProject): The project to build. entrypoint (EntryPoint): The entrypoint to use. ...
python
wandb/sdk/launch/builder/docker_builder.py
109
181
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,130
__init__
def __init__( self, builder_config: Dict[str, Any], environment: AbstractEnvironment, registry: AbstractRegistry, ) -> None: """Initialize a NoOpBuilder.""" pass
python
wandb/sdk/launch/builder/noop.py
17
24
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,131
from_config
def from_config( cls, config: dict, environment: AbstractEnvironment, registry: AbstractRegistry, verify: bool = True, ) -> "AbstractBuilder": """Create a noop builder from a config.""" return cls(config, environment, registry)
python
wandb/sdk/launch/builder/noop.py
27
35
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,132
verify
def verify(self) -> None: """Verify the builder.""" raise LaunchError("Attempted to verify noop builder.")
python
wandb/sdk/launch/builder/noop.py
37
39
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,133
build_image
def build_image( self, launch_project: LaunchProject, entrypoint: EntryPoint, ) -> str: """Build the image. For this we raise a launch error since it can't build. """ raise LaunchError( "Attempted build with noop builder. Specify a builder in your...
python
wandb/sdk/launch/builder/noop.py
41
52
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,134
install_deps
def install_deps( deps: List[str], failed: Optional[Set[str]] = None, extra_index: Optional[str] = None, opts: Optional[List[str]] = None, ) -> Optional[Set[str]]: """Install pip dependencies. Arguments: deps {List[str]} -- List of dependencies to install failed (set, None): The...
python
wandb/sdk/launch/builder/templates/_wandb_bootstrap.py
26
76
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,135
main
def main() -> None: """Install deps in requirements.frozen.txt.""" extra_index = None torch_reqs = [] if os.path.exists("requirements.frozen.txt"): with open("requirements.frozen.txt") as f: print("Installing frozen dependencies...") reqs = [] failed: Set[str]...
python
wandb/sdk/launch/builder/templates/_wandb_bootstrap.py
79
130
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,136
find_package_in_error_string
def find_package_in_error_string(deps: List[str], line: str) -> Optional[str]: # if the last word in the error string is in the list of deps, return it last_word = line.split(" ")[-1] if last_word in deps: return last_word # if the last word is not in the list of deps, check all words # TODO...
python
wandb/sdk/launch/builder/templates/_wandb_bootstrap.py
136
149
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,137
_find_available
def _find_available( current_version: str, ) -> Optional[Tuple[str, bool, bool, bool, Optional[str]]]: from pkg_resources import parse_version pypi_url = f"https://pypi.org/pypi/{wandb._wandb_module}/json" yanked_dict = {} try: # raise Exception("test") async_requests_get = wandb.u...
python
wandb/sdk/internal/update.py
8
73
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,138
check_available
def check_available(current_version: str) -> Optional[Dict[str, Optional[str]]]: package_info = _find_available(current_version) if not package_info: return None wandb_module_name = wandb._wandb_module latest_version, pip_prerelease, deleted, yanked, yanked_reason = package_info upgrade_me...
python
wandb/sdk/internal/update.py
76
114
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,139
_framework_priority
def _framework_priority() -> Generator[Tuple[str, str], None, None]: yield from [ ("lightgbm", "lightgbm"), ("catboost", "catboost"), ("xgboost", "xgboost"), ("transformers_huggingface", "huggingface"), # backwards compatibility ("transformers", "huggingface"), ("pyt...
python
wandb/sdk/internal/sender.py
92
107
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,140
_manifest_json_from_proto
def _manifest_json_from_proto(manifest: "ArtifactManifest") -> Dict: if manifest.version == 1: contents = { content.path: { "digest": content.digest, "birthArtifactID": content.birth_artifact_id if content.birth_artifact_id else Non...
python
wandb/sdk/internal/sender.py
110
138
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,141
__init__
def __init__(self) -> None: self.resumed = False self.step = 0 self.history = 0 self.events = 0 self.output = 0 self.runtime = 0 # wandb_runtime is the canonical runtime (stored in summary._wandb.runtime) self.wandb_runtime = None self.summary = No...
python
wandb/sdk/internal/sender.py
152
162
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,142
__str__
def __str__(self) -> str: obj = ",".join(map(lambda it: f"{it[0]}={it[1]}", vars(self).items())) return f"ResumeState({obj})"
python
wandb/sdk/internal/sender.py
164
166
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,143
__init__
def __init__(self, stream: str, sm: "SendManager"): self._stopped = threading.Event() self._queue = queue.Queue() self._emulator = redirect.TerminalEmulator() self._writer_thr = threading.Thread( target=sm._output_raw_writer_thread, kwargs=dict(stream=stream), ...
python
wandb/sdk/internal/sender.py
176
191
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,144
start
def start(self) -> None: self._writer_thr.start() self._reader_thr.start()
python
wandb/sdk/internal/sender.py
193
195
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,145
__init__
def __init__( self, settings: SettingsStatic, record_q: "Queue[Record]", result_q: "Queue[Result]", interface: InterfaceQueue, context_keeper: context.ContextKeeper, ) -> None: self._settings = settings self._record_q = record_q self._result_q ...
python
wandb/sdk/internal/sender.py
231
307
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,146
setup
def setup(cls, root_dir: str, resume: Union[None, bool, str]) -> "SendManager": """Set up a standalone SendManager. Currently, we're using this primarily for `sync.py`. """ files_dir = os.path.join(root_dir, "files") # TODO(settings) replace with wandb.Settings sd: Setti...
python
wandb/sdk/internal/sender.py
310
354
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,147
__len__
def __len__(self) -> int: return self._record_q.qsize()
python
wandb/sdk/internal/sender.py
356
357
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,148
retry_callback
def retry_callback(self, status: int, response_text: str) -> None: response = wandb_internal_pb2.HttpResponse() response.http_status_code = status response.http_response_text = response_text self._retry_q.put(response)
python
wandb/sdk/internal/sender.py
359
363
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,149
send
def send(self, record: "Record") -> None: self._update_record_num(record.num) self._update_end_offset(record.control.end_offset) record_type = record.WhichOneof("record_type") assert record_type handler_str = "send_" + record_type send_handler = getattr(self, handler_str...
python
wandb/sdk/internal/sender.py
365
387
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,150
send_preempting
def send_preempting(self, record: "Record") -> None: if self._fs: self._fs.enqueue_preempting()
python
wandb/sdk/internal/sender.py
389
391
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,151
send_request_sender_mark
def send_request_sender_mark(self, record: "Record") -> None: self._maybe_report_status(always=True)
python
wandb/sdk/internal/sender.py
393
394
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,152
send_request
def send_request(self, record: "Record") -> None: request_type = record.request.WhichOneof("request_type") assert request_type handler_str = "send_request_" + request_type send_handler = getattr(self, handler_str, None) if request_type != "network_status": logger.debu...
python
wandb/sdk/internal/sender.py
396
404
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,153
_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/sender.py
406
410
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,154
_flatten
def _flatten(self, dictionary: Dict) -> None: if type(dictionary) == dict: for k, v in list(dictionary.items()): if type(v) == dict: self._flatten(v) dictionary.pop(k) for k2, v2 in v.items(): diction...
python
wandb/sdk/internal/sender.py
412
419
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,155
_update_record_num
def _update_record_num(self, record_num: int) -> None: if not record_num: return # Currently how we handle offline mode and syncing is not # compatible with this assertion due to how the exit record # is (mis)handled: # - using "always_send" in offline mode to trigg...
python
wandb/sdk/internal/sender.py
421
433
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,156
_update_end_offset
def _update_end_offset(self, end_offset: int) -> None: if not end_offset: return self._send_end_offset = end_offset
python
wandb/sdk/internal/sender.py
435
438
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,157
send_request_sender_read
def send_request_sender_read(self, record: "Record") -> None: if self._ds is None: self._ds = datastore.DataStore() self._ds.open_for_scan(self._settings.sync_file) # TODO(cancel_paused): implement cancel_set logic # The idea is that there is an active request to cancel ...
python
wandb/sdk/internal/sender.py
440
468
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,158
send_request_check_version
def send_request_check_version(self, record: "Record") -> None: assert record.control.req_resp or record.control.mailbox_slot result = proto_util._result_from_record(record) current_version = ( record.request.check_version.current_version or wandb.__version__ ) messag...
python
wandb/sdk/internal/sender.py
470
487
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,159
_send_request_attach
def _send_request_attach( self, req: wandb_internal_pb2.AttachRequest, resp: wandb_internal_pb2.AttachResponse, ) -> None: attach_id = req.attach_id assert attach_id assert self._run resp.run.CopyFrom(self._run)
python
wandb/sdk/internal/sender.py
489
497
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,160
send_request_attach
def send_request_attach(self, record: "Record") -> None: assert record.control.req_resp or record.control.mailbox_slot result = proto_util._result_from_record(record) self._send_request_attach( record.request.attach, result.response.attach_response ) self._respond_res...
python
wandb/sdk/internal/sender.py
499
505
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,161
send_request_stop_status
def send_request_stop_status(self, record: "Record") -> None: result = proto_util._result_from_record(record) status_resp = result.response.stop_status_response status_resp.run_should_stop = False if self._entity and self._project and self._run and self._run.run_id: try: ...
python
wandb/sdk/internal/sender.py
507
518
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,162
_maybe_update_config
def _maybe_update_config(self, always: bool = False) -> None: time_now = time.monotonic() if ( not always and time_now < self._debounce_config_time + self.UPDATE_CONFIG_TIME ): return if self._config_needs_debounce: self._debounce_config() ...
python
wandb/sdk/internal/sender.py
520
529
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,163
_maybe_report_status
def _maybe_report_status(self, always: bool = False) -> None: time_now = time.monotonic() if ( not always and time_now < self._debounce_status_time + self.UPDATE_STATUS_TIME ): return self._debounce_status_time = time_now status_report = wandb...
python
wandb/sdk/internal/sender.py
531
547
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,164
debounce
def debounce(self, final: bool = False) -> None: self._maybe_report_status(always=final) self._maybe_update_config(always=final)
python
wandb/sdk/internal/sender.py
549
551
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,165
_debounce_config
def _debounce_config(self) -> None: config_value_dict = self._config_format(self._consolidated_config) # TODO(jhr): check result of upsert_run? if self._run: self._api.upsert_run( name=self._run.run_id, config=config_value_dict, **self._api_settings # type: ignore ...
python
wandb/sdk/internal/sender.py
553
561
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,166
send_request_network_status
def send_request_network_status(self, record: "Record") -> None: result = proto_util._result_from_record(record) status_resp = result.response.network_status_response while True: try: status_resp.network_responses.append(self._retry_q.get_nowait()) except ...
python
wandb/sdk/internal/sender.py
563
573
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,167
send_request_login
def send_request_login(self, record: "Record") -> None: # TODO: do something with api_key or anonymous? # TODO: return an error if we aren't logged in? self._api.reauth() viewer = self.get_viewer_info() server_info = self.get_server_info() # self._login_flags = json.loads...
python
wandb/sdk/internal/sender.py
575
590
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,168
send_exit
def send_exit(self, record: "Record") -> None: # track where the exit came from self._record_exit = record run_exit = record.exit self._exit_code = run_exit.exit_code logger.info("handling exit code: %s", run_exit.exit_code) runtime = run_exit.runtime logger.info...
python
wandb/sdk/internal/sender.py
592
607
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,169
send_final
def send_final(self, record: "Record") -> None: pass
python
wandb/sdk/internal/sender.py
609
610
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,170
_flush_run
def _flush_run(self) -> None: pass
python
wandb/sdk/internal/sender.py
612
613
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,171
send_request_status_report
def send_request_status_report(self, record: "Record") -> None: # todo? this is just a noop to please wandb sync pass
python
wandb/sdk/internal/sender.py
615
617
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,172
send_request_defer
def send_request_defer(self, record: "Record") -> None: # noqa: C901 defer = record.request.defer state = defer.state logger.info(f"handle sender defer: {state}") def transition_state() -> None: state = defer.state + 1 logger.info(f"send defer: {state}") ...
python
wandb/sdk/internal/sender.py
619
701
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,173
transition_state
def transition_state() -> None: state = defer.state + 1 logger.info(f"send defer: {state}") self._interface.publish_defer(state)
python
wandb/sdk/internal/sender.py
624
627
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,174
send_request_poll_exit
def send_request_poll_exit(self, record: "Record") -> None: if not record.control.req_resp and not record.control.mailbox_slot: return result = proto_util._result_from_record(record) if self._pusher: _alive, status = self._pusher.get_status() file_counts = s...
python
wandb/sdk/internal/sender.py
703
725
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,175
send_request_server_info
def send_request_server_info(self, record: "Record") -> None: assert record.control.req_resp or record.control.mailbox_slot result = proto_util._result_from_record(record) result.response.server_info_response.local_info.CopyFrom(self.get_local_info()) for message in self._server_message...
python
wandb/sdk/internal/sender.py
727
747
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,176
_maybe_setup_resume
def _maybe_setup_resume( self, run: "RunRecord" ) -> Optional["wandb_internal_pb2.ErrorInfo"]: """Queries the backend for a run; fail if the settings are incompatible.""" if not self._settings.resume: return None # TODO: This causes a race, we need to make the upsert ato...
python
wandb/sdk/internal/sender.py
749
834
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,177
_telemetry_get_framework
def _telemetry_get_framework(self) -> str: """Get telemetry data for internal config structure.""" # detect framework by checking what is loaded imports: telemetry.TelemetryImports if self._telemetry_obj.HasField("imports_finish"): imports = self._telemetry_obj.imports_finish...
python
wandb/sdk/internal/sender.py
836
849
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,178
_config_telemetry_update
def _config_telemetry_update(self, config_dict: Dict[str, Any]) -> None: """Add legacy telemetry to config object.""" wandb_key = "_wandb" config_dict.setdefault(wandb_key, dict()) s: str b: bool s = self._telemetry_obj.python_version if s: config_dict...
python
wandb/sdk/internal/sender.py
851
877
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,179
_config_metric_update
def _config_metric_update(self, config_dict: Dict[str, Any]) -> None: """Add default xaxis to config.""" if not self._config_metric_pbdict_list: return wandb_key = "_wandb" config_dict.setdefault(wandb_key, dict()) config_dict[wandb_key]["m"] = self._config_metric_pbd...
python
wandb/sdk/internal/sender.py
879
885
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,180
_config_format
def _config_format(self, config_data: Optional[DictNoValues]) -> DictWithValues: """Format dict into value dict with telemetry info.""" config_dict: Dict[str, Any] = config_data.copy() if config_data else dict() self._config_telemetry_update(config_dict) self._config_metric_update(config...
python
wandb/sdk/internal/sender.py
887
893
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,181
_config_save
def _config_save(self, config_value_dict: DictWithValues) -> None: config_path = os.path.join(self._settings.files_dir, "config.yaml") config_util.save_config_file_from_dict(config_path, config_value_dict)
python
wandb/sdk/internal/sender.py
895
897
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,182
_sync_spell
def _sync_spell(self) -> None: """Sync this run with spell.""" if not self._run: return try: env = os.environ self._interface.publish_config( key=("_wandb", "spell_url"), val=env.get("SPELL_RUN_URL") ) url = "{}/{}/{}/ru...
python
wandb/sdk/internal/sender.py
899
918
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,183
send_run
def send_run(self, record: "Record", file_dir: Optional[str] = None) -> None: run = record.run error = None is_wandb_init = self._run is None # save start time of a run self._start_time = run.start_time.ToMicroseconds() / 1e6 # update telemetry if run.telemetry:...
python
wandb/sdk/internal/sender.py
920
1,002
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,184
_init_run
def _init_run( self, run: "RunRecord", config_dict: Optional[DictWithValues], ) -> None: # We subtract the previous runs runtime when resuming start_time = ( run.start_time.ToMicroseconds() / 1e6 ) - self._resume_state.runtime # TODO: we don't chec...
python
wandb/sdk/internal/sender.py
1,004
1,088
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,185
_start_run_threads
def _start_run_threads(self, file_dir: Optional[str] = None) -> None: assert self._run # self._run is configured by caller self._fs = file_stream.FileStreamApi( self._api, self._run.run_id, self._run.start_time.ToMicroseconds() / 1e6, settings=self._api_s...
python
wandb/sdk/internal/sender.py
1,090
1,128
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,186
_save_history
def _save_history(self, history_dict: Dict[str, Any]) -> None: if self._fs: self._fs.push(filenames.HISTORY_FNAME, json.dumps(history_dict))
python
wandb/sdk/internal/sender.py
1,130
1,132
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,187
send_history
def send_history(self, record: "Record") -> None: history = record.history history_dict = proto_util.dict_from_proto_list(history.item) self._save_history(history_dict)
python
wandb/sdk/internal/sender.py
1,134
1,137
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,188
_update_summary_record
def _update_summary_record(self, summary: "SummaryRecord") -> None: summary_dict = proto_util.dict_from_proto_list(summary.update) self._cached_summary = summary_dict self._update_summary()
python
wandb/sdk/internal/sender.py
1,139
1,142
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,189
send_summary
def send_summary(self, record: "Record") -> None: self._update_summary_record(record.summary)
python
wandb/sdk/internal/sender.py
1,144
1,145
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,190
send_request_summary_record
def send_request_summary_record(self, record: "Record") -> None: self._update_summary_record(record.request.summary_record.summary)
python
wandb/sdk/internal/sender.py
1,147
1,148
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,191
_update_summary
def _update_summary(self) -> None: summary_dict = self._cached_summary.copy() summary_dict.pop("_wandb", None) if self._metadata_summary: summary_dict["_wandb"] = self._metadata_summary json_summary = json.dumps(summary_dict) if self._fs: self._fs.push(fil...
python
wandb/sdk/internal/sender.py
1,150
1,162
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,192
send_stats
def send_stats(self, record: "Record") -> None: stats = record.stats if stats.stats_type != wandb_internal_pb2.StatsRecord.StatsType.SYSTEM: return if not self._fs: return if not self._run: return now_us = stats.timestamp.ToMicroseconds() ...
python
wandb/sdk/internal/sender.py
1,164
1,183
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,193
_output_raw_finish
def _output_raw_finish(self) -> None: for stream, output_raw in self._output_raw_streams.items(): output_raw._stopped.set() # shut down threads output_raw._writer_thr.join(timeout=5) if output_raw._writer_thr.is_alive(): logger.info("processing ou...
python
wandb/sdk/internal/sender.py
1,185
1,201
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,194
_output_raw_writer_thread
def _output_raw_writer_thread(self, stream: "StreamLiterals") -> None: while True: output_raw = self._output_raw_streams[stream] if output_raw._queue.empty(): if output_raw._stopped.is_set(): return time.sleep(0.5) conti...
python
wandb/sdk/internal/sender.py
1,203
1,224
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,195
_output_raw_reader_thread
def _output_raw_reader_thread(self, stream: "StreamLiterals") -> None: output_raw = self._output_raw_streams[stream] while not (output_raw._stopped.is_set() and output_raw._queue.empty()): self._output_raw_flush(stream) time.sleep(_OUTPUT_MIN_CALLBACK_INTERVAL)
python
wandb/sdk/internal/sender.py
1,226
1,230
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,196
_output_raw_flush
def _output_raw_flush( self, stream: "StreamLiterals", data: Optional[str] = None ) -> None: if data is None: output_raw = self._output_raw_streams[stream] try: data = output_raw._emulator.read() except Exception as e: logger.warnin...
python
wandb/sdk/internal/sender.py
1,232
1,244
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,197
send_output
def send_output(self, record: "Record") -> None: if not self._fs: return out = record.output stream: "StreamLiterals" = "stdout" if out.output_type == wandb_internal_pb2.OutputRecord.OutputType.STDERR: stream = "stderr" line = out.line self._send_o...
python
wandb/sdk/internal/sender.py
1,246
1,254
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,198
send_output_raw
def send_output_raw(self, record: "Record") -> None: if not self._fs: return out = record.output_raw stream: "StreamLiterals" = "stdout" if out.output_type == wandb_internal_pb2.OutputRawRecord.OutputType.STDERR: stream = "stderr" line = out.line ...
python
wandb/sdk/internal/sender.py
1,256
1,286
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,199
_send_output_line
def _send_output_line(self, stream: "StreamLiterals", line: str) -> None: """Combined writer for raw and non raw output lines. This is combined because they are both post emulator. """ prepend = "" if stream == "stderr": prepend = "ERROR " if not line.endswit...
python
wandb/sdk/internal/sender.py
1,288
1,316
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
4,200
_update_config
def _update_config(self) -> None: self._config_needs_debounce = True
python
wandb/sdk/internal/sender.py
1,318
1,319
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }