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,601 | __init__ | def __init__(self) -> None:
self._opened_for_scan = False
self._fp = None
self._index = 0
self._flush_offset = 0
self._size_bytes = 0
self._crc = [0] * (LEVELDBLOG_LAST + 1)
for x in range(1, LEVELDBLOG_LAST + 1):
self._crc[x] = zlib.crc32(strtobytes(... | python | wandb/sdk/internal/datastore.py | 68 | 81 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,602 | open_for_write | def open_for_write(self, fname: str) -> None:
self._fname = fname
logger.info("open: %s", fname)
open_flags = "xb"
self._fp = open(fname, open_flags)
self._write_header() | python | wandb/sdk/internal/datastore.py | 83 | 88 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,603 | open_for_append | def open_for_append(self, fname):
# TODO: implement
self._fname = fname
logger.info("open: %s", fname)
self._fp = open(fname, "wb")
# do something with _index | python | wandb/sdk/internal/datastore.py | 90 | 95 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,604 | open_for_scan | def open_for_scan(self, fname):
self._fname = fname
logger.info("open for scan: %s", fname)
self._fp = open(fname, "r+b")
self._index = 0
self._size_bytes = os.stat(fname).st_size
self._opened_for_scan = True
self._read_header() | python | wandb/sdk/internal/datastore.py | 97 | 104 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,605 | seek | def seek(self, offset: int) -> None:
self._fp.seek(offset)
self._index = offset | python | wandb/sdk/internal/datastore.py | 106 | 108 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,606 | get_offset | def get_offset(self) -> int:
offset = self._fp.tell()
return offset | python | wandb/sdk/internal/datastore.py | 110 | 112 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,607 | in_last_block | def in_last_block(self):
"""Determine if we're in the last block to handle in-progress writes."""
return self._index > self._size_bytes - LEVELDBLOG_DATA_LEN | python | wandb/sdk/internal/datastore.py | 114 | 116 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,608 | scan_record | def scan_record(self):
assert self._opened_for_scan, "file not open for scanning"
# TODO(jhr): handle some assertions as file corruption issues
# assume we have enough room to read header, checked by caller?
header = self._fp.read(LEVELDBLOG_HEADER_LEN)
if len(header) == 0:
... | python | wandb/sdk/internal/datastore.py | 118 | 140 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,609 | scan_data | def scan_data(self):
# TODO(jhr): handle some assertions as file corruption issues
# how much left in the block. if less than header len, read as pad,
offset = self._index % LEVELDBLOG_BLOCK_LEN
space_left = LEVELDBLOG_BLOCK_LEN - offset
if space_left < LEVELDBLOG_HEADER_LEN:
... | python | wandb/sdk/internal/datastore.py | 142 | 179 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,610 | _write_header | def _write_header(self):
data = struct.pack(
"<4sHB",
strtobytes(LEVELDBLOG_HEADER_IDENT),
LEVELDBLOG_HEADER_MAGIC,
LEVELDBLOG_HEADER_VERSION,
)
assert (
len(data) == LEVELDBLOG_HEADER_LEN
), "header size is {} bytes, expected {... | python | wandb/sdk/internal/datastore.py | 181 | 194 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,611 | _read_header | def _read_header(self):
header = self._fp.read(LEVELDBLOG_HEADER_LEN)
assert (
len(header) == LEVELDBLOG_HEADER_LEN
), "header is {} bytes instead of the expected {}".format(
len(header), LEVELDBLOG_HEADER_LEN
)
ident, magic, version = struct.unpack("<4sHB... | python | wandb/sdk/internal/datastore.py | 196 | 210 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,612 | _write_record | def _write_record(self, s, dtype=None):
"""Write record that must fit into a block."""
# double check that there is enough space
# (this is a precondition to calling this method)
assert len(s) + LEVELDBLOG_HEADER_LEN <= (
LEVELDBLOG_BLOCK_LEN - self._index % LEVELDBLOG_BLOCK_... | python | wandb/sdk/internal/datastore.py | 212 | 229 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,613 | _write_data | def _write_data(self, s):
start_offset = self._index
offset = self._index % LEVELDBLOG_BLOCK_LEN
space_left = LEVELDBLOG_BLOCK_LEN - offset
data_used = 0
data_left = len(s)
# logger.info("write_data: index=%d offset=%d len=%d",
# self._index, offset, data_lef... | python | wandb/sdk/internal/datastore.py | 231 | 274 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,614 | ensure_flushed | def ensure_flushed(self, off: int) -> None:
self._fp.flush() | python | wandb/sdk/internal/datastore.py | 276 | 277 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,615 | write | def write(self, obj: "Record") -> Tuple[int, int, int]:
"""Write a protocol buffer.
Arguments:
obj: Protocol buffer to write.
Returns:
(start_offset, end_offset, flush_offset) if successful,
None otherwise
"""
raw_size = obj.ByteSize()
... | python | wandb/sdk/internal/datastore.py | 279 | 294 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,616 | close | def close(self) -> None:
if self._fp is not None:
logger.info("close: %s", self._fname)
self._fp.close() | python | wandb/sdk/internal/datastore.py | 296 | 299 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,617 | __init__ | def __init__(self) -> None:
self.metrics_queue: "queue.Queue[dict]" = queue.Queue()
self.telemetry_queue: "queue.Queue[TelemetryRecord]" = queue.Queue() | python | wandb/sdk/internal/system/system_monitor.py | 21 | 23 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,618 | publish_stats | def publish_stats(self, stats: dict) -> None:
self.metrics_queue.put(stats) | python | wandb/sdk/internal/system/system_monitor.py | 25 | 26 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,619 | _publish_telemetry | def _publish_telemetry(self, telemetry: "TelemetryRecord") -> None:
self.telemetry_queue.put(telemetry) | python | wandb/sdk/internal/system/system_monitor.py | 28 | 29 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,620 | publish_files | def publish_files(self, files_dict: "FilesDict") -> None:
pass | python | wandb/sdk/internal/system/system_monitor.py | 31 | 32 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,621 | __init__ | def __init__(
self,
settings: "SettingsStatic",
interface: "Interface",
) -> None:
self._shutdown_event: threading.Event = threading.Event()
self._process: Optional[threading.Thread] = None
self.settings = settings
# settings._stats_join_assets controls whet... | python | wandb/sdk/internal/system/system_monitor.py | 41 | 88 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,622 | _get_assets | def _get_assets(self) -> List["Asset"]:
return [
asset_class(
interface=self.asset_interface or self.backend_interface,
settings=self.settings,
shutdown_event=self._shutdown_event,
)
for asset_class in asset_registry
] | python | wandb/sdk/internal/system/system_monitor.py | 90 | 98 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,623 | _get_open_metrics_assets | def _get_open_metrics_assets(self) -> List["Asset"]:
open_metrics_endpoints = self.settings._stats_open_metrics_endpoints
if not open_metrics_endpoints:
return []
assets: List[Asset] = []
for name, endpoint in open_metrics_endpoints.items():
if not OpenMetrics.is... | python | wandb/sdk/internal/system/system_monitor.py | 100 | 119 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,624 | aggregate_and_publish_asset_metrics | def aggregate_and_publish_asset_metrics(self) -> None:
if self.asset_interface is None:
return None
# only extract as many items as are available in the queue at the moment
size = self.asset_interface.metrics_queue.qsize()
aggregated_metrics = {}
for _ in range(size)... | python | wandb/sdk/internal/system/system_monitor.py | 121 | 133 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,625 | publish_telemetry | def publish_telemetry(self) -> None:
if self.asset_interface is None:
return None
# get everything from the self.asset_interface.telemetry_queue,
# merge into a single dictionary and publish on the backend_interface
while not self.asset_interface.telemetry_queue.empty():
... | python | wandb/sdk/internal/system/system_monitor.py | 135 | 142 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,626 | _start | def _start(self) -> None:
logger.info("Starting system asset monitoring threads")
for asset in self.assets:
asset.start()
# compatibility mode: join stats from different assets before publishing
if not (self.join_assets and self.asset_interface is not None):
retu... | python | wandb/sdk/internal/system/system_monitor.py | 144 | 175 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,627 | start | def start(self) -> None:
self._shutdown_event.clear()
if self._process is not None:
return None
logger.info("Starting system monitor")
self._process = threading.Thread(
target=self._start, daemon=True, name="SystemMonitor"
)
self._process.start() | python | wandb/sdk/internal/system/system_monitor.py | 177 | 185 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,628 | finish | def finish(self) -> None:
if self._process is None:
return None
logger.info("Stopping system monitor")
self._shutdown_event.set()
for asset in self.assets:
asset.finish()
try:
self._process.join()
except Exception as e:
logg... | python | wandb/sdk/internal/system/system_monitor.py | 187 | 198 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,629 | probe | def probe(self, publish: bool = True) -> None:
logger.info("Collecting system info")
# collect static info about the hardware from registered assets
hardware_info: dict = {
k: v for d in [asset.probe() for asset in self.assets] for k, v in d.items()
}
# collect static... | python | wandb/sdk/internal/system/system_monitor.py | 200 | 216 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,630 | __init__ | def __init__(self, settings: SettingsStatic, interface: Interface) -> None:
logger.debug("System info init")
self.settings = settings
self.metadata_file_name = os.path.join(self.settings.files_dir, METADATA_FNAME)
self.backend_interface = interface
self.git = GitRepo(
... | python | wandb/sdk/internal/system/system_info.py | 30 | 46 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,631 | _save_pip | def _save_pip(self) -> None:
"""Save the current working set of pip packages to {REQUIREMENTS_FNAME}."""
logger.debug(
"Saving list of pip packages installed into the current environment"
)
try:
import pkg_resources
installed_packages = [d for d in it... | python | wandb/sdk/internal/system/system_info.py | 49 | 67 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,632 | _save_conda | def _save_conda(self) -> None:
current_shell_is_conda = os.path.exists(os.path.join(sys.prefix, "conda-meta"))
if not current_shell_is_conda:
return None
logger.debug(
"Saving list of conda packages installed into the current environment"
)
try:
... | python | wandb/sdk/internal/system/system_info.py | 69 | 86 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,633 | _save_code | def _save_code(self) -> None:
logger.debug("Saving code")
if self.settings.program_relpath is None:
logger.warning("unable to save code -- program entry not found")
return None
root: str = self.git.root or os.getcwd()
program_relative: str = self.settings.program... | python | wandb/sdk/internal/system/system_info.py | 88 | 110 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,634 | _save_patches | def _save_patches(self) -> None:
"""Save the current state of this repository to one or more patches.
Makes one patch against HEAD and another one against the most recent
commit that occurs in an upstream branch. This way we can be robust
to history editing as long as the user never doe... | python | wandb/sdk/internal/system/system_info.py | 112 | 169 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,635 | _probe_git | def _probe_git(self, data: Dict[str, Any]) -> Dict[str, Any]:
if self.settings.disable_git:
return data
# in case of manually passing the git repo info, `enabled` would be False,
# but we still want to save the git repo info
if not self.git.enabled and self.git.auto:
... | python | wandb/sdk/internal/system/system_info.py | 171 | 190 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,636 | probe | def probe(self) -> Dict[str, Any]:
"""Probe the system for information about the current environment."""
# todo: refactor this quality code 🤮🤮🤮🤮🤮
logger.debug("Probing system")
data: Dict[str, Any] = dict()
data["os"] = self.settings._os
data["python"] = self.settin... | python | wandb/sdk/internal/system/system_info.py | 192 | 242 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,637 | publish | def publish(self, system_info: dict) -> None:
# save pip, conda, code patches to disk
if self.settings._save_requirements:
self._save_pip()
self._save_conda()
if self.settings.save_code:
self._save_code()
self._save_patches()
# save system... | python | wandb/sdk/internal/system/system_info.py | 244 | 268 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,638 | sample | def sample(self) -> None:
"""Sample the metric."""
... # pragma: no cover | python | wandb/sdk/internal/system/assets/interfaces.py | 34 | 36 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,639 | clear | def clear(self) -> None:
"""Clear the samples."""
... # pragma: no cover | python | wandb/sdk/internal/system/assets/interfaces.py | 38 | 40 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,640 | aggregate | def aggregate(self) -> dict:
"""Aggregate the samples."""
... # pragma: no cover | python | wandb/sdk/internal/system/assets/interfaces.py | 42 | 44 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,641 | setup | def setup(self) -> None:
"""Extra setup required for the metric beyond __init__."""
... # pragma: no cover | python | wandb/sdk/internal/system/assets/interfaces.py | 51 | 53 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,642 | teardown | def teardown(self) -> None:
"""Extra teardown required for the metric."""
... # pragma: no cover | python | wandb/sdk/internal/system/assets/interfaces.py | 55 | 57 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,643 | __init__ | def __init__(self, *args: Any, **kwargs: Any) -> None:
... # pragma: no cover | python | wandb/sdk/internal/system/assets/interfaces.py | 71 | 72 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,644 | is_available | def is_available(cls) -> bool:
"""Check if the resource is available."""
... # pragma: no cover | python | wandb/sdk/internal/system/assets/interfaces.py | 75 | 77 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,645 | start | def start(self) -> None:
"""Start monitoring the resource."""
... # pragma: no cover | python | wandb/sdk/internal/system/assets/interfaces.py | 79 | 81 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,646 | finish | def finish(self) -> None:
"""Finish monitoring the resource."""
... # pragma: no cover | python | wandb/sdk/internal/system/assets/interfaces.py | 83 | 85 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,647 | probe | def probe(self) -> dict:
"""Get static information about the resource."""
... # pragma: no cover | python | wandb/sdk/internal/system/assets/interfaces.py | 87 | 89 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,648 | publish_stats | def publish_stats(self, stats: dict) -> None:
... # pragma: no cover | python | wandb/sdk/internal/system/assets/interfaces.py | 93 | 94 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,649 | _publish_telemetry | def _publish_telemetry(self, telemetry: "TelemetryRecord") -> None:
... # pragma: no cover | python | wandb/sdk/internal/system/assets/interfaces.py | 96 | 97 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,650 | publish_files | def publish_files(self, files_dict: "FilesDict") -> None:
... # pragma: no cover | python | wandb/sdk/internal/system/assets/interfaces.py | 99 | 100 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,651 | __init__ | def __init__(
self,
asset_name: str,
metrics: List[Metric],
interface: Interface,
settings: "SettingsStatic",
shutdown_event: threading.Event,
) -> None:
self.metrics = metrics
self.asset_name = asset_name
self._interface = interface
se... | python | wandb/sdk/internal/system/assets/interfaces.py | 106 | 130 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,652 | monitor | def monitor(self) -> None:
"""Poll the Asset metrics."""
while not self._shutdown_event.is_set():
for _ in range(self.samples_to_aggregate):
for metric in self.metrics:
try:
metric.sample()
except psutil.NoSuchPr... | python | wandb/sdk/internal/system/assets/interfaces.py | 132 | 148 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,653 | aggregate | def aggregate(self) -> dict:
"""Return a dict of metrics."""
aggregated_metrics = {}
for metric in self.metrics:
try:
serialized_metric = metric.aggregate()
aggregated_metrics.update(serialized_metric)
# aggregated_metrics = wandb.util.... | python | wandb/sdk/internal/system/assets/interfaces.py | 150 | 162 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,654 | publish | def publish(self) -> None:
"""Publish the Asset metrics."""
try:
aggregated_metrics = self.aggregate()
if aggregated_metrics:
self._interface.publish_stats(aggregated_metrics)
for metric in self.metrics:
metric.clear()
except Ex... | python | wandb/sdk/internal/system/assets/interfaces.py | 164 | 173 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,655 | start | def start(self) -> None:
if (self._process is not None) or self._shutdown_event.is_set():
return None
thread_name = f"{self.asset_name[:15]}" # thread names are limited to 15 chars
try:
for metric in self.metrics:
if isinstance(metric, SetupTeardown):
... | python | wandb/sdk/internal/system/assets/interfaces.py | 175 | 193 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,656 | finish | def finish(self) -> None:
if self._process is None:
return None
thread_name = f"{self.asset_name[:15]}"
try:
self._process.join()
logger.info(f"Joined {thread_name} monitor")
for metric in self.metrics:
if isinstance(metric, SetupT... | python | wandb/sdk/internal/system/assets/interfaces.py | 195 | 209 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,657 | __init__ | def __init__(self) -> None:
self.samples = deque([]) | python | wandb/sdk/internal/system/assets/disk.py | 27 | 28 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,658 | sample | def sample(self) -> None:
self.samples.append(psutil.disk_usage("/").percent) | python | wandb/sdk/internal/system/assets/disk.py | 30 | 31 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,659 | clear | def clear(self) -> None:
self.samples.clear() | python | wandb/sdk/internal/system/assets/disk.py | 33 | 34 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,660 | aggregate | def aggregate(self) -> dict:
if not self.samples:
return {}
aggregate = aggregate_mean(self.samples)
return {self.name: aggregate} | python | wandb/sdk/internal/system/assets/disk.py | 36 | 40 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,661 | __init__ | def __init__(
self,
interface: "Interface",
settings: "SettingsStatic",
shutdown_event: threading.Event,
) -> None:
self.name = self.__class__.__name__.lower()
self.metrics: List[Metric] = [DiskUsage()]
self.metrics_monitor = MetricsMonitor(
self.n... | python | wandb/sdk/internal/system/assets/disk.py | 45 | 59 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,662 | is_available | def is_available(cls) -> bool:
"""Return a new instance of the CPU metrics."""
return psutil is not None | python | wandb/sdk/internal/system/assets/disk.py | 62 | 64 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,663 | probe | def probe(self) -> dict:
# total disk space:
total = psutil.disk_usage("/").total / 1024 / 1024 / 1024
# total disk space used:
used = psutil.disk_usage("/").used / 1024 / 1024 / 1024
return {self.name: {"total": total, "used": used}} | python | wandb/sdk/internal/system/assets/disk.py | 66 | 71 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,664 | start | def start(self) -> None:
self.metrics_monitor.start() | python | wandb/sdk/internal/system/assets/disk.py | 73 | 74 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,665 | finish | def finish(self) -> None:
self.metrics_monitor.finish() | python | wandb/sdk/internal/system/assets/disk.py | 76 | 77 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,666 | __init__ | def __init__(self, pid: int, gc_ipu_info: Optional[Any] = None) -> None:
self.samples: "Deque[dict]" = deque()
if gc_ipu_info is None:
if not gcipuinfo:
raise ImportError(
"Monitoring IPU stats requires gcipuinfo to be installed"
)
... | python | wandb/sdk/internal/system/assets/ipu.py | 40 | 55 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,667 | parse_metric | def parse_metric(key: str, value: str) -> Optional[Tuple[str, Union[int, float]]]:
metric_suffixes = {
"temp": "C",
"clock": "MHz",
"power": "W",
"utilisation": "%",
"utilisation (session)": "%",
"speed": "GT/s",
}
for metr... | python | wandb/sdk/internal/system/assets/ipu.py | 58 | 79 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,668 | sample | def sample(self) -> None:
try:
stats = {}
devices = self._gc_ipu_info.getDevices()
for device in devices:
device_metrics: Dict[str, str] = dict(device)
pid = device_metrics.get("user process id")
if pid is None or int(pid) != ... | python | wandb/sdk/internal/system/assets/ipu.py | 81 | 111 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,669 | clear | def clear(self) -> None:
self.samples.clear() | python | wandb/sdk/internal/system/assets/ipu.py | 113 | 114 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,670 | aggregate | def aggregate(self) -> dict:
if not self.samples:
return {}
stats = {}
for key in self.samples[0].keys():
samples = [s[key] for s in self.samples if key in s]
aggregate = aggregate_mean(samples)
stats[key] = aggregate
return stats | python | wandb/sdk/internal/system/assets/ipu.py | 116 | 124 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,671 | __init__ | def __init__(
self,
interface: "Interface",
settings: "SettingsStatic",
shutdown_event: threading.Event,
) -> None:
self.name = self.__class__.__name__.lower()
self.metrics: List[Metric] = [
IPUStats(settings._stats_pid),
]
self.metrics_mon... | python | wandb/sdk/internal/system/assets/ipu.py | 129 | 145 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,672 | is_available | def is_available(cls) -> bool:
return gcipuinfo is not None | python | wandb/sdk/internal/system/assets/ipu.py | 148 | 149 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,673 | start | def start(self) -> None:
self.metrics_monitor.start() | python | wandb/sdk/internal/system/assets/ipu.py | 151 | 152 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,674 | finish | def finish(self) -> None:
self.metrics_monitor.finish() | python | wandb/sdk/internal/system/assets/ipu.py | 154 | 155 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,675 | probe | def probe(self) -> dict:
device_data = self.metrics[0]._gc_ipu_info.getDevices() # type: ignore
device_count = len(device_data)
devices = []
for i, device in enumerate(device_data):
device_metrics: Dict[str, str] = dict(device)
devices.append(
{
... | python | wandb/sdk/internal/system/assets/ipu.py | 157 | 177 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,676 | __init__ | def __init__(self, pid: int) -> None:
self.pid = pid
self.process: Optional[psutil.Process] = None
self.samples = deque([]) | python | wandb/sdk/internal/system/assets/memory.py | 30 | 33 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,677 | sample | def sample(self) -> None:
if self.process is None:
self.process = psutil.Process(self.pid)
self.samples.append(self.process.memory_info().rss / 1024 / 1024) | python | wandb/sdk/internal/system/assets/memory.py | 35 | 39 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,678 | clear | def clear(self) -> None:
self.samples.clear() | python | wandb/sdk/internal/system/assets/memory.py | 41 | 42 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,679 | aggregate | def aggregate(self) -> dict:
if not self.samples:
return {}
aggregate = aggregate_mean(self.samples)
return {self.name: aggregate} | python | wandb/sdk/internal/system/assets/memory.py | 44 | 48 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,680 | __init__ | def __init__(self, pid: int) -> None:
self.pid = pid
self.process: Optional[psutil.Process] = None
self.samples = deque([]) | python | wandb/sdk/internal/system/assets/memory.py | 58 | 61 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,681 | sample | def sample(self) -> None:
if self.process is None:
self.process = psutil.Process(self.pid)
self.samples.append(self.process.memory_percent()) | python | wandb/sdk/internal/system/assets/memory.py | 63 | 67 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,682 | clear | def clear(self) -> None:
self.samples.clear() | python | wandb/sdk/internal/system/assets/memory.py | 69 | 70 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,683 | aggregate | def aggregate(self) -> dict:
if not self.samples:
return {}
aggregate = aggregate_mean(self.samples)
return {self.name: aggregate} | python | wandb/sdk/internal/system/assets/memory.py | 72 | 76 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,684 | __init__ | def __init__(self) -> None:
self.samples = deque([]) | python | wandb/sdk/internal/system/assets/memory.py | 86 | 87 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,685 | sample | def sample(self) -> None:
self.samples.append(psutil.virtual_memory().percent) | python | wandb/sdk/internal/system/assets/memory.py | 89 | 90 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,686 | clear | def clear(self) -> None:
self.samples.clear() | python | wandb/sdk/internal/system/assets/memory.py | 92 | 93 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,687 | aggregate | def aggregate(self) -> dict:
if not self.samples:
return {}
aggregate = aggregate_mean(self.samples)
return {self.name: aggregate} | python | wandb/sdk/internal/system/assets/memory.py | 95 | 99 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,688 | __init__ | def __init__(self) -> None:
self.samples = deque([]) | python | wandb/sdk/internal/system/assets/memory.py | 109 | 110 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,689 | sample | def sample(self) -> None:
self.samples.append(psutil.virtual_memory().available / 1024 / 1024) | python | wandb/sdk/internal/system/assets/memory.py | 112 | 113 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,690 | clear | def clear(self) -> None:
self.samples.clear() | python | wandb/sdk/internal/system/assets/memory.py | 115 | 116 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,691 | aggregate | def aggregate(self) -> dict:
if not self.samples:
return {}
aggregate = aggregate_mean(self.samples)
return {self.name: aggregate} | python | wandb/sdk/internal/system/assets/memory.py | 118 | 122 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,692 | __init__ | def __init__(
self,
interface: "Interface",
settings: "SettingsStatic",
shutdown_event: threading.Event,
) -> None:
self.name = self.__class__.__name__.lower()
self.metrics: List[Metric] = [
MemoryAvailable(),
MemoryPercent(),
Proce... | python | wandb/sdk/internal/system/assets/memory.py | 127 | 146 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,693 | start | def start(self) -> None:
self.metrics_monitor.start() | python | wandb/sdk/internal/system/assets/memory.py | 148 | 149 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,694 | finish | def finish(self) -> None:
self.metrics_monitor.finish() | python | wandb/sdk/internal/system/assets/memory.py | 151 | 152 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,695 | is_available | def is_available(cls) -> bool:
"""Return a new instance of the CPU metrics."""
return psutil is not None | python | wandb/sdk/internal/system/assets/memory.py | 155 | 157 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,696 | probe | def probe(self) -> dict:
"""Return a dict of the hardware information."""
# total available memory in gigabytes
return {
"memory": {
"total": psutil.virtual_memory().total / 1024 / 1024 / 1024,
}
} | python | wandb/sdk/internal/system/assets/memory.py | 159 | 166 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,697 | __init__ | def __init__(self, pid: int) -> None:
self.pid = pid
self.samples: "Deque[float]" = deque([])
self.process: Optional[psutil.Process] = None | python | wandb/sdk/internal/system/assets/cpu.py | 28 | 31 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,698 | sample | def sample(self) -> None:
# todo: this is what we'd eventually want to do
# self.samples.append(
# (
# datetime.datetime.utcnow(),
# psutil.Process(self.pid).cpu_percent(),
# )
# )
if self.process is None:
self.process =... | python | wandb/sdk/internal/system/assets/cpu.py | 33 | 44 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,699 | clear | def clear(self) -> None:
self.samples.clear() | python | wandb/sdk/internal/system/assets/cpu.py | 46 | 47 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,700 | aggregate | def aggregate(self) -> dict:
# todo: create a statistics class with helper methods to compute
# mean, median, min, max, etc.
if not self.samples:
return {}
aggregate = aggregate_mean(self.samples)
return {self.name: aggregate} | python | wandb/sdk/internal/system/assets/cpu.py | 49 | 55 | {
"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.