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
3,801
_set_artifact_target
def _set_artifact_target( self, artifact: "LocalArtifact", name: Optional[str] = None ) -> None: assert ( self._artifact_target is None ), "Cannot update artifact_target. Existing target: {}/{}".format( self._artifact_target.artifact, self._artifact_target.name ...
python
wandb/sdk/data_types/base_types/wb_value.py
198
206
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,802
_get_artifact_entry_ref_url
def _get_artifact_entry_ref_url(self) -> Optional[str]: # If the object is coming from another artifact if self._artifact_source and self._artifact_source.name: ref_entry = self._artifact_source.artifact.get_path( type(self).with_suffix(self._artifact_source.name) ...
python
wandb/sdk/data_types/base_types/wb_value.py
208
244
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,803
_get_artifact_entry_latest_ref_url
def _get_artifact_entry_latest_ref_url(self) -> Optional[str]: if ( self._artifact_target and self._artifact_target.name and self._artifact_target.artifact._client_id is not None and self._artifact_target.artifact._final and _server_accepts_client_ids(...
python
wandb/sdk/data_types/base_types/wb_value.py
246
275
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,804
__init__
def __init__(self, val: dict, key: str) -> None: """Initialize a BoundingBoxes object. The input dictionary `val` should contain the keys: box_data: a list of dictionaries, each of which describes a bounding box. class_labels: (optional) A map of integer class labels to their re...
python
wandb/sdk/data_types/helper_types/bounding_boxes_2d.py
150
197
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,805
bind_to_run
def bind_to_run( self, run: "LocalRun", key: Union[int, str], step: Union[int, str], id_: Optional[Union[int, str]] = None, ignore_copy_err: Optional[bool] = None, ) -> None: # bind_to_run key argument is the Image parent key # the self._key value is t...
python
wandb/sdk/data_types/helper_types/bounding_boxes_2d.py
199
214
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,806
type_name
def type_name(cls) -> str: return "boxes2D"
python
wandb/sdk/data_types/helper_types/bounding_boxes_2d.py
217
218
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,807
validate
def validate(self, val: dict) -> bool: # Optional argument if "class_labels" in val: for k, v in list(val["class_labels"].items()): if (not isinstance(k, numbers.Number)) or (not isinstance(v, str)): raise TypeError( "Class labels m...
python
wandb/sdk/data_types/helper_types/bounding_boxes_2d.py
220
275
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,808
to_json
def to_json(self, run_or_artifact: Union["LocalRun", "LocalArtifact"]) -> dict: if isinstance(run_or_artifact, wandb.wandb_sdk.wandb_run.Run): return super().to_json(run_or_artifact) elif isinstance(run_or_artifact, wandb.wandb_sdk.wandb_artifacts.Artifact): # TODO (tim): I would...
python
wandb/sdk/data_types/helper_types/bounding_boxes_2d.py
277
286
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,809
from_json
def from_json( cls: Type["BoundingBoxes2D"], json_obj: dict, source_artifact: "PublicArtifact" ) -> "BoundingBoxes2D": return cls({"box_data": json_obj}, "")
python
wandb/sdk/data_types/helper_types/bounding_boxes_2d.py
289
292
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,810
__init__
def __init__(self, class_set: Sequence[dict]) -> None: """Classes is holds class metadata intended to be used in concert with other objects when visualizing artifacts. Args: class_set (list): list of dicts in the form of {"id":int|str, "name":str} """ super().__init__() ...
python
wandb/sdk/data_types/helper_types/classes.py
19
28
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,811
from_json
def from_json( cls: Type["Classes"], json_obj: dict, source_artifact: Optional["PublicArtifact"], ) -> "Classes": return cls(json_obj.get("class_set")) # type: ignore
python
wandb/sdk/data_types/helper_types/classes.py
31
36
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,812
to_json
def to_json( self, run_or_artifact: Optional[Union["LocalRun", "LocalArtifact"]] ) -> dict: json_obj = {} # This is a bit of a hack to allow _ClassesIdType to # be able to operate fully without an artifact in play. # In all other cases, artifact should be a true artifact. ...
python
wandb/sdk/data_types/helper_types/classes.py
38
49
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,813
get_type
def get_type(self) -> "_ClassesIdType": return _ClassesIdType(self)
python
wandb/sdk/data_types/helper_types/classes.py
51
52
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,814
__ne__
def __ne__(self, other: object) -> bool: return not self.__eq__(other)
python
wandb/sdk/data_types/helper_types/classes.py
54
55
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,815
__eq__
def __eq__(self, other: object) -> bool: if isinstance(other, Classes): return self._class_set == other._class_set else: return False
python
wandb/sdk/data_types/helper_types/classes.py
57
61
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,816
__init__
def __init__( self, classes_obj: Optional[Classes] = None, valid_ids: Optional["_dtypes.UnionType"] = None, ): if valid_ids is None: valid_ids = _dtypes.UnionType() elif isinstance(valid_ids, list): valid_ids = _dtypes.UnionType( [_dtyp...
python
wandb/sdk/data_types/helper_types/classes.py
69
103
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,817
assign
def assign(self, py_obj: Optional[Any] = None) -> "_dtypes.Type": return self.assign_type(_dtypes.ConstType(py_obj))
python
wandb/sdk/data_types/helper_types/classes.py
105
106
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,818
assign_type
def assign_type(self, wb_type: "_dtypes.Type") -> "_dtypes.Type": valid_ids = self.params["valid_ids"].assign_type(wb_type) if not isinstance(valid_ids, _dtypes.InvalidType): return self return _dtypes.InvalidType()
python
wandb/sdk/data_types/helper_types/classes.py
108
113
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,819
from_obj
def from_obj(cls, py_obj: Optional[Any] = None) -> "_dtypes.Type": return cls(py_obj)
python
wandb/sdk/data_types/helper_types/classes.py
116
117
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,820
to_json
def to_json(self, artifact: Optional["LocalArtifact"] = None) -> Dict[str, Any]: cl_dict = super().to_json(artifact) # TODO (tss): Refactor this block with the similar one in wandb.Image. # This is a bit of a smell that the classes object does not follow # the same file-pattern as other ...
python
wandb/sdk/data_types/helper_types/classes.py
119
134
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,821
from_json
def from_json( cls, json_dict: Dict[str, Any], artifact: Optional["PublicArtifact"] = None, ) -> "_dtypes.Type": classes_obj = None if ( json_dict.get("params", {}).get("classes_obj", {}).get("type") == "classes-file" ): if artifact...
python
wandb/sdk/data_types/helper_types/classes.py
137
158
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,822
__init__
def __init__(self, val: dict, key: str) -> None: """Initialize an ImageMask object. Arguments: val: (dictionary) One of these two keys to represent the image: mask_data : (2D numpy array) The mask containing an integer class label for each pixel in the im...
python
wandb/sdk/data_types/helper_types/image_mask.py
118
159
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,823
bind_to_run
def bind_to_run( self, run: "LocalRun", key: Union[int, str], step: Union[int, str], id_: Optional[Union[int, str]] = None, ignore_copy_err: Optional[bool] = None, ) -> None: # bind_to_run key argument is the Image parent key # the self._key value is t...
python
wandb/sdk/data_types/helper_types/image_mask.py
161
179
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,824
get_media_subdir
def get_media_subdir(cls: Type["ImageMask"]) -> str: return os.path.join("media", "images", cls.type_name())
python
wandb/sdk/data_types/helper_types/image_mask.py
182
183
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,825
from_json
def from_json( cls: Type["ImageMask"], json_obj: dict, source_artifact: "PublicArtifact" ) -> "ImageMask": return cls( {"path": source_artifact.get_path(json_obj["path"]).download()}, key="", )
python
wandb/sdk/data_types/helper_types/image_mask.py
186
192
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,826
to_json
def to_json(self, run_or_artifact: Union["LocalRun", "LocalArtifact"]) -> dict: json_dict = super().to_json(run_or_artifact) if isinstance(run_or_artifact, wandb.wandb_sdk.wandb_run.Run): json_dict["_type"] = self.type_name() return json_dict elif isinstance(run_or_artif...
python
wandb/sdk/data_types/helper_types/image_mask.py
194
204
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,827
type_name
def type_name(cls: Type["ImageMask"]) -> str: return cls._log_type
python
wandb/sdk/data_types/helper_types/image_mask.py
207
208
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,828
validate
def validate(self, val: dict) -> bool: np = util.get_module("numpy", required="Image mask support requires numpy") # 2D Make this work with all tensor(like) types if "mask_data" not in val: raise TypeError( 'Missing key "mask_data": An image mask requires mask data: a...
python
wandb/sdk/data_types/helper_types/image_mask.py
210
234
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,829
nice_id
def nice_id(name): return ID_PREFIX + "-" + name
python
wandb/sdk/verify/verify.py
29
30
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,830
print_results
def print_results( failed_test_or_tests: Optional[Union[str, List[str]]], warning: bool ) -> None: if warning: color = "yellow" else: color = "red" if isinstance(failed_test_or_tests, str): print(RED_X) print(click.style(failed_test_or_tests, fg=color, bold=True)) eli...
python
wandb/sdk/verify/verify.py
33
51
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,831
check_host
def check_host(host: str) -> bool: if host in ("api.wandb.ai", "http://api.wandb.ai", "https://api.wandb.ai"): print_results("Cannot run wandb verify against api.wandb.ai", False) return False return True
python
wandb/sdk/verify/verify.py
54
58
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,832
check_logged_in
def check_logged_in(api: Api, host: str) -> bool: print("Checking if logged in".ljust(72, "."), end="") login_doc_url = "https://docs.wandb.ai/ref/cli/wandb-login" fail_string = None if api.api_key is None: fail_string = ( "Not logged in. Please log in using `wandb login`. See the do...
python
wandb/sdk/verify/verify.py
61
82
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,833
check_secure_requests
def check_secure_requests(url: str, test_url_string: str, failure_output: str) -> None: # check if request is over https print(test_url_string.ljust(72, "."), end="") fail_string = None if not url.startswith("https"): fail_string = failure_output print_results(fail_string, True)
python
wandb/sdk/verify/verify.py
85
91
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,834
check_cors_configuration
def check_cors_configuration(url: str, origin: str) -> None: print("Checking CORs configuration of the bucket".ljust(72, "."), end="") fail_string = None res_get = requests.options( url, headers={"Origin": origin, "Access-Control-Request-Method": "GET"} ) if res_get.headers.get("Access-Cont...
python
wandb/sdk/verify/verify.py
94
107
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,835
check_run
def check_run(api: Api) -> bool: print( "Checking logged metrics, saving and downloading a file".ljust(72, "."), end="" ) failed_test_strings = [] # set up config n_epochs = 4 string_test = "A test config" dict_test = {"config_val": 2, "config_string": "config string"} list_test...
python
wandb/sdk/verify/verify.py
110
206
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,836
verify_manifest
def verify_manifest( downloaded_manifest: Dict[str, Any], computed_manifest: Dict[str, Any], fails_list: List[str], ) -> None: try: for key in computed_manifest.keys(): assert ( computed_manifest[key]["digest"] == downloaded_manifest[key]["digest"] ) ...
python
wandb/sdk/verify/verify.py
209
223
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,837
verify_digest
def verify_digest( downloaded: "ArtifactAPI", computed: "ArtifactAPI", fails_list: List[str] ) -> None: if downloaded.digest != computed.digest: fails_list.append( "Artifact digest does not appear as expected. Contact W&B for support." )
python
wandb/sdk/verify/verify.py
226
232
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,838
artifact_with_path_or_paths
def artifact_with_path_or_paths( name: str, verify_dir: Optional[str] = None, singular: bool = False ) -> "Artifact": art = wandb.Artifact(type="artsy", name=name) # internal file with open("verify_int_test.txt", "w") as f: f.write("test 1") f.close() art.add_file(f.name) if ...
python
wandb/sdk/verify/verify.py
235
261
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,839
log_use_download_artifact
def log_use_download_artifact( artifact: "Artifact", alias: str, name: str, download_dir: str, failed_test_strings: List[str], add_extra_file: bool, ) -> Tuple[bool, Optional["ArtifactAPI"], List[str]]: with wandb.init( id=nice_id("log_artifact"), reinit=True, project...
python
wandb/sdk/verify/verify.py
264
308
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,840
check_artifacts
def check_artifacts() -> bool: print("Checking artifact save and download workflows".ljust(72, "."), end="") failed_test_strings: List[str] = [] # test checksum sing_art_dir = "./verify_sing_art" alias = "sing_art1" name = "sing-artys" singular_art = artifact_with_path_or_paths(name, singul...
python
wandb/sdk/verify/verify.py
311
366
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,841
check_graphql_put
def check_graphql_put(api: Api, host: str) -> Tuple[bool, Optional[str]]: # check graphql endpoint using an upload print("Checking signed URL upload".ljust(72, "."), end="") failed_test_strings = [] gql_fp = "gql_test_file.txt" f = open(gql_fp, "w") f.write("test2") f.close() with wandb....
python
wandb/sdk/verify/verify.py
369
412
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,842
check_large_post
def check_large_post() -> bool: print( "Checking ability to send large payloads through proxy".ljust(72, "."), end="" ) descy = "a" * int(10**7) username = getpass.getuser() failed_test_strings = [] query = gql( """ query Project($entity: String!, $name: String!, $runNam...
python
wandb/sdk/verify/verify.py
415
459
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,843
check_wandb_version
def check_wandb_version(api: Api) -> None: print("Checking wandb package version is up to date".ljust(72, "."), end="") _, server_info = api.viewer_server_info() fail_string = None warning = False max_cli_version = server_info.get("cliVersionInfo", {}).get("max_cli_version", None) min_cli_versio...
python
wandb/sdk/verify/verify.py
462
483
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,844
retry_fn
def retry_fn(fn: Callable) -> Any: ini_time = time.time() res = None i = 0 while i < MIN_RETRYS or time.time() - ini_time < GET_RUN_MAX_TIME: i += 1 try: res = fn() break except Exception: time.sleep(1) continue return res
python
wandb/sdk/verify/verify.py
486
498
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,845
push_to_queue
def push_to_queue( api: Api, queue_name: str, launch_spec: Dict[str, Any], project_queue: str ) -> Any: try: res = api.push_to_run_queue(queue_name, launch_spec, project_queue) except Exception as e: wandb.termwarn(f"{LOG_PREFIX}Exception when pushing to queue {e}") return None r...
python
wandb/sdk/launch/launch_add.py
21
29
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,846
launch_add
def launch_add( uri: Optional[str] = None, job: Optional[str] = None, config: Optional[Dict[str, Any]] = None, project: Optional[str] = None, entity: Optional[str] = None, queue_name: Optional[str] = None, resource: Optional[str] = None, entry_point: Optional[List[str]] = None, name:...
python
wandb/sdk/launch/launch_add.py
32
120
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,847
_launch_add
def _launch_add( api: Api, uri: Optional[str], job: Optional[str], config: Optional[Dict[str, Any]], project: Optional[str], entity: Optional[str], queue_name: Optional[str], resource: Optional[str], entry_point: Optional[List[str]], name: Optional[str], version: Optional[str...
python
wandb/sdk/launch/launch_add.py
123
225
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,848
is_bare
def is_bare(self) -> bool: return self.host is None
python
wandb/sdk/launch/wandb_reference.py
53
54
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,849
is_job
def is_job(self) -> bool: return self.ref_type == ReferenceType.JOB
python
wandb/sdk/launch/wandb_reference.py
56
57
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,850
is_run
def is_run(self) -> bool: return self.ref_type == ReferenceType.RUN
python
wandb/sdk/launch/wandb_reference.py
59
60
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,851
is_job_or_run
def is_job_or_run(self) -> bool: return self.is_job() or self.is_run()
python
wandb/sdk/launch/wandb_reference.py
62
63
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,852
job_reference
def job_reference(self) -> str: assert self.is_job() return f"{self.job_name}:{self.job_alias}"
python
wandb/sdk/launch/wandb_reference.py
65
67
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,853
job_reference_scoped
def job_reference_scoped(self) -> str: assert self.entity assert self.project unscoped = self.job_reference() return f"{self.entity}/{self.project}/{unscoped}"
python
wandb/sdk/launch/wandb_reference.py
69
73
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,854
url_host
def url_host(self) -> str: return f"{PREFIX_HTTPS}{self.host}" if self.host else ""
python
wandb/sdk/launch/wandb_reference.py
75
76
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,855
url_entity
def url_entity(self) -> str: assert self.entity return f"{self.url_host()}/{self.entity}"
python
wandb/sdk/launch/wandb_reference.py
78
80
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,856
url_project
def url_project(self) -> str: assert self.project return f"{self.url_entity()}/{self.project}"
python
wandb/sdk/launch/wandb_reference.py
82
84
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,857
parse
def parse(uri: str) -> Optional["WandbReference"]: """Attempt to parse a string as a W&B URL.""" # TODO: Error if HTTP and host is not localhost? if ( not uri.startswith("/") and not uri.startswith(PREFIX_HTTP) and not uri.startswith(PREFIX_HTTPS) ): ...
python
wandb/sdk/launch/wandb_reference.py
87
131
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,858
is_uri_job_or_run
def is_uri_job_or_run(uri: str) -> bool: ref = WandbReference.parse(uri) if ref and ref.is_job_or_run(): return True return False
python
wandb/sdk/launch/wandb_reference.py
134
138
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,859
__init__
def __init__( self, uri: Optional[str], job: Optional[str], api: Api, launch_spec: Dict[str, Any], target_entity: str, target_project: str, name: Optional[str], docker_config: Dict[str, Any], git_info: Dict[str, str], overrides: Dic...
python
wandb/sdk/launch/_project_spec.py
48
145
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,860
base_image
def base_image(self) -> str: """Returns {PROJECT}_base:{PYTHON_VERSION}.""" # TODO: this should likely be source_project when we have it... # don't make up a separate base image name if user provides a docker image if self.docker_image is not None: return self.docker_image ...
python
wandb/sdk/launch/_project_spec.py
148
160
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,861
image_name
def image_name(self) -> str: if self.docker_image is not None: return self.docker_image elif self.uri is not None: cleaned_uri = self.uri.replace("https://", "/") first_sep = cleaned_uri.find("/") shortened_uri = cleaned_uri[first_sep:] return ...
python
wandb/sdk/launch/_project_spec.py
163
174
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,862
build_required
def build_required(self) -> bool: """Checks the source to see if a build is required.""" # since the image tag for images built from jobs # is based on the job version index, which is immutable # we don't need to build the image for a job if that tag # already exists if s...
python
wandb/sdk/launch/_project_spec.py
176
184
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,863
docker_image
def docker_image(self) -> Optional[str]: return self._docker_image
python
wandb/sdk/launch/_project_spec.py
187
188
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,864
docker_image
def docker_image(self, value: str) -> None: self._docker_image = value self._ensure_not_docker_image_and_local_process()
python
wandb/sdk/launch/_project_spec.py
191
193
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,865
get_single_entry_point
def get_single_entry_point(self) -> Optional["EntryPoint"]: """Returns the first entrypoint for the project, or None if no entry point was provided because a docker image was provided.""" # assuming project only has 1 entry point, pull that out # tmp fn until we figure out if we want to support ...
python
wandb/sdk/launch/_project_spec.py
195
205
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,866
add_entry_point
def add_entry_point(self, command: List[str]) -> "EntryPoint": """Add an entry point to the project.""" entry_point = command[-1] new_entrypoint = EntryPoint(name=entry_point, command=command) self._entry_points[entry_point] = new_entrypoint return new_entrypoint
python
wandb/sdk/launch/_project_spec.py
207
212
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,867
_ensure_not_docker_image_and_local_process
def _ensure_not_docker_image_and_local_process(self) -> None: if self.docker_image is not None and self.resource == "local-process": raise LaunchError( "Cannot specify docker image with local-process resource runner" )
python
wandb/sdk/launch/_project_spec.py
214
218
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,868
_fetch_job
def _fetch_job(self) -> None: public_api = wandb.apis.public.Api() job_dir = tempfile.mkdtemp() try: job = public_api.job(self.job, path=job_dir) except CommError: raise LaunchError( f"Job {self.job} not found. Jobs have the format: <entity>/<proje...
python
wandb/sdk/launch/_project_spec.py
220
230
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,869
get_image_source_string
def get_image_source_string(self) -> str: """Returns a unique string identifying the source of an image.""" if self.source == LaunchSource.LOCAL: # TODO: more correct to get a hash of local uri contents assert isinstance(self.uri, str) return self.uri elif sel...
python
wandb/sdk/launch/_project_spec.py
232
255
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,870
_fetch_project_local
def _fetch_project_local(self, internal_api: Api) -> None: """Fetch a project (either wandb run or git repo) into a local directory, returning the path to the local project directory.""" # these asserts are all guaranteed to pass, but are required by mypy assert self.source != LaunchSource.LOCAL...
python
wandb/sdk/launch/_project_spec.py
257
359
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,871
__init__
def __init__(self, name: str, command: List[str]): self.name = name self.command = command
python
wandb/sdk/launch/_project_spec.py
365
367
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,872
compute_command
def compute_command(self, user_parameters: Optional[Dict[str, Any]]) -> List[str]: """Converts user parameter dictionary to a string.""" command_arr = [] command_arr += self.command extras = compute_command_args(user_parameters) command_arr += extras return command_arr
python
wandb/sdk/launch/_project_spec.py
369
375
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,873
compute_command_args
def compute_command_args(parameters: Optional[Dict[str, Any]]) -> List[str]: arr: List[str] = [] if parameters is None: return arr for key, value in parameters.items(): if value is not None: arr.append(f"--{key}") arr.append(quote(str(value))) else: ...
python
wandb/sdk/launch/_project_spec.py
378
388
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,874
get_entry_point_command
def get_entry_point_command( entry_point: Optional["EntryPoint"], parameters: Dict[str, Any] ) -> List[str]: """Returns the shell command to execute in order to run the specified entry point. Arguments: entry_point: Entry point to run parameters: Parameters (dictionary) for the entry point command ...
python
wandb/sdk/launch/_project_spec.py
391
405
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,875
create_project_from_spec
def create_project_from_spec(launch_spec: Dict[str, Any], api: Api) -> LaunchProject: """Constructs a LaunchProject instance using a launch spec. Arguments: launch_spec: Dictionary representation of launch spec api: Instance of wandb.apis.internal Api Returns: An initialized `LaunchProject...
python
wandb/sdk/launch/_project_spec.py
408
435
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,876
fetch_and_validate_project
def fetch_and_validate_project( launch_project: LaunchProject, api: Api ) -> LaunchProject: """Fetches a project into a local directory, adds the config values to the directory, and validates the first entrypoint for the project. Arguments: launch_project: LaunchProject to fetch and validate. api: ...
python
wandb/sdk/launch/_project_spec.py
438
476
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,877
create_metadata_file
def create_metadata_file( launch_project: LaunchProject, image_uri: str, sanitized_entrypoint_str: str, sanitized_dockerfile_contents: str, ) -> None: assert launch_project.project_dir is not None with open( os.path.join(launch_project.project_dir, DEFAULT_LAUNCH_METADATA_PATH), ...
python
wandb/sdk/launch/_project_spec.py
479
498
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,878
resolve_agent_config
def resolve_agent_config( # noqa: C901 api: Api, entity: Optional[str], project: Optional[str], max_jobs: Optional[int], queues: Optional[Tuple[str]], config: Optional[str], ) -> Tuple[Dict[str, Any], Api]: """Resolve the agent config. Arguments: api (Api): The api. ent...
python
wandb/sdk/launch/launch.py
28
129
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,879
create_and_run_agent
def create_and_run_agent( api: Api, config: Dict[str, Any], ) -> None: agent = LaunchAgent(api, config) agent.loop()
python
wandb/sdk/launch/launch.py
132
137
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,880
_run
def _run( uri: Optional[str], job: Optional[str], name: Optional[str], project: Optional[str], entity: Optional[str], docker_image: Optional[str], entry_point: Optional[List[str]], version: Optional[str], parameters: Optional[Dict[str, Any]], resource: str, resource_args: Opt...
python
wandb/sdk/launch/launch.py
140
200
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,881
run
def run( api: Api, uri: Optional[str] = None, job: Optional[str] = None, entry_point: Optional[List[str]] = None, version: Optional[str] = None, parameters: Optional[Dict[str, Any]] = None, name: Optional[str] = None, resource: Optional[str] = None, resource_args: Optional[Dict[str, ...
python
wandb/sdk/launch/launch.py
203
294
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,882
_wait_for
def _wait_for(submitted_run_obj: AbstractRun) -> None: """Wait on the passed-in submitted run, reporting its status to the tracking server.""" # Note: there's a small chance we fail to report the run's status to the tracking server if # we're interrupted before we reach the try block below try: ...
python
wandb/sdk/launch/launch.py
297
309
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,883
_is_wandb_uri
def _is_wandb_uri(uri: str) -> bool: return ( _WANDB_URI_REGEX.match(uri) or _WANDB_DEV_URI_REGEX.match(uri) or _WANDB_LOCAL_DEV_URI_REGEX.match(uri) or _WANDB_QA_URI_REGEX.match(uri) ) is not None
python
wandb/sdk/launch/utils.py
85
91
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,884
_is_wandb_dev_uri
def _is_wandb_dev_uri(uri: str) -> bool: return bool(_WANDB_DEV_URI_REGEX.match(uri))
python
wandb/sdk/launch/utils.py
94
95
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,885
_is_wandb_local_uri
def _is_wandb_local_uri(uri: str) -> bool: return bool(_WANDB_LOCAL_DEV_URI_REGEX.match(uri))
python
wandb/sdk/launch/utils.py
98
99
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,886
_is_git_uri
def _is_git_uri(uri: str) -> bool: return bool(_GIT_URI_REGEX.match(uri))
python
wandb/sdk/launch/utils.py
102
103
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,887
sanitize_wandb_api_key
def sanitize_wandb_api_key(s: str) -> str: return str(re.sub(API_KEY_REGEX, "WANDB_API_KEY", s))
python
wandb/sdk/launch/utils.py
106
107
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,888
get_project_from_job
def get_project_from_job(job: str) -> Optional[str]: job_parts = job.split("/") if len(job_parts) == 3: return job_parts[1] return None
python
wandb/sdk/launch/utils.py
110
114
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,889
set_project_entity_defaults
def set_project_entity_defaults( uri: Optional[str], job: Optional[str], api: Api, project: Optional[str], entity: Optional[str], launch_config: Optional[Dict[str, Any]], ) -> Tuple[str, str]: # set the target project and entity if not provided source_uri = None if uri is not None: ...
python
wandb/sdk/launch/utils.py
117
148
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,890
construct_launch_spec
def construct_launch_spec( uri: Optional[str], job: Optional[str], api: Api, name: Optional[str], project: Optional[str], entity: Optional[str], docker_image: Optional[str], resource: Optional[str], entry_point: Optional[List[str]], version: Optional[str], parameters: Optiona...
python
wandb/sdk/launch/utils.py
151
231
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,891
validate_launch_spec_source
def validate_launch_spec_source(launch_spec: Dict[str, Any]) -> None: uri = launch_spec.get("uri") job = launch_spec.get("job") docker_image = launch_spec.get("docker", {}).get("docker_image") if not bool(uri) and not bool(job) and not bool(docker_image): raise LaunchError("Must specify a uri, ...
python
wandb/sdk/launch/utils.py
234
244
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,892
parse_wandb_uri
def parse_wandb_uri(uri: str) -> Tuple[str, str, str]: """Parse wandb uri to retrieve entity, project and run name.""" ref = WandbReference.parse(uri) if not ref or not ref.entity or not ref.project or not ref.run_id: raise LaunchError(f"Trouble parsing wandb uri {uri}") return (ref.entity, ref....
python
wandb/sdk/launch/utils.py
247
252
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,893
is_bare_wandb_uri
def is_bare_wandb_uri(uri: str) -> bool: """Check that a wandb uri is valid. URI must be in the format `/<entity>/<project>/runs/<run_name>[other stuff]` or `/<entity>/<project>/artifacts/job/<job_name>[other stuff]`. """ _logger.info(f"Checking if uri {uri} is bare...") return uri.star...
python
wandb/sdk/launch/utils.py
255
264
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,894
fetch_wandb_project_run_info
def fetch_wandb_project_run_info( entity: str, project: str, run_name: str, api: Api ) -> Any: _logger.info("Fetching run info...") try: result = api.get_run_info(entity, project, run_name) except CommError: result = None if result is None: raise LaunchError( f"Ru...
python
wandb/sdk/launch/utils.py
267
293
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,895
download_entry_point
def download_entry_point( entity: str, project: str, run_name: str, api: Api, entry_point: str, dir: str ) -> bool: metadata = api.download_url( project, f"code/{entry_point}", run=run_name, entity=entity ) if metadata is not None: _, response = api.download_file(metadata["url"]) ...
python
wandb/sdk/launch/utils.py
296
308
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,896
download_wandb_python_deps
def download_wandb_python_deps( entity: str, project: str, run_name: str, api: Api, dir: str ) -> Optional[str]: reqs = api.download_url(project, "requirements.txt", run=run_name, entity=entity) if reqs is not None: _logger.info("Downloading python dependencies") _, response = api.download_f...
python
wandb/sdk/launch/utils.py
311
325
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,897
get_local_python_deps
def get_local_python_deps( dir: str, filename: str = "requirements.local.txt" ) -> Optional[str]: try: env = os.environ with open(os.path.join(dir, filename), "w") as f: subprocess.call(["pip", "freeze"], env=env, stdout=f) return filename except subprocess.CalledProcessE...
python
wandb/sdk/launch/utils.py
328
338
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,898
diff_pip_requirements
def diff_pip_requirements(req_1: List[str], req_2: List[str]) -> Dict[str, str]: """Return a list of pip requirements that are not in req_1 but are in req_2.""" def _parse_req(req: List[str]) -> Dict[str, str]: # TODO: This can be made more exhaustive, but for 99% of cases this is fine # see ht...
python
wandb/sdk/launch/utils.py
341
395
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,899
_parse_req
def _parse_req(req: List[str]) -> Dict[str, str]: # TODO: This can be made more exhaustive, but for 99% of cases this is fine # see https://pip.pypa.io/en/stable/reference/requirements-file-format/#example d: Dict[str, str] = dict() for line in req: _name: str = None # type:...
python
wandb/sdk/launch/utils.py
344
377
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }
3,900
validate_wandb_python_deps
def validate_wandb_python_deps( requirements_file: Optional[str], dir: str, ) -> None: """Warn if local python dependencies differ from wandb requirements.txt.""" if requirements_file is not None: requirements_path = os.path.join(dir, requirements_file) with open(requirements_path) as f:...
python
wandb/sdk/launch/utils.py
398
416
{ "name": "Git-abouvier/wandb", "url": "https://github.com/Git-abouvier/wandb.git", "license": "MIT", "stars": 0, "forks": 0 }