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,401 | handle_request_log_artifact | def handle_request_log_artifact(self, record: Record) -> None:
self._dispatch_record(record) | python | wandb/sdk/internal/handler.py | 632 | 633 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,402 | handle_request_artifact_send | def handle_request_artifact_send(self, record: Record) -> None:
assert record.control.req_resp
result = proto_util._result_from_record(record)
self._dispatch_record(record)
# send response immediately, the request will be polled for result
xid = record.uuid
result.response.artifact_send_response.xid = xid
self._respond_result(result) | python | wandb/sdk/internal/handler.py | 635 | 644 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,403 | handle_request_artifact_poll | def handle_request_artifact_poll(self, record: Record) -> None:
assert record.control.req_resp
xid = record.request.artifact_poll.xid
assert xid
result = proto_util._result_from_record(record)
done_req = self._artifact_xid_done.get(xid)
if done_req:
result.response.artifact_poll_response.artifact_id = done_req.artifact_id
result.response.artifact_poll_response.error_message = (
done_req.error_message
)
result.response.artifact_poll_response.ready = True
self._respond_result(result) | python | wandb/sdk/internal/handler.py | 646 | 659 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,404 | handle_request_artifact_done | def handle_request_artifact_done(self, record: Record) -> None:
assert not record.control.req_resp
done_req = record.request.artifact_done
xid = done_req.xid
assert xid
self._artifact_xid_done[xid] = done_req | python | wandb/sdk/internal/handler.py | 661 | 667 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,405 | handle_telemetry | def handle_telemetry(self, record: Record) -> None:
self._dispatch_record(record) | python | wandb/sdk/internal/handler.py | 673 | 674 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,406 | handle_request_run_start | def handle_request_run_start(self, record: Record) -> None:
run_start = record.request.run_start
assert run_start
assert run_start.run
self._run_start_time = run_start.run.start_time.ToMicroseconds() / 1e6
self._track_time = time.time()
if run_start.run.resumed and run_start.run.runtime:
self._accumulate_time = run_start.run.runtime
else:
self._accumulate_time = 0
# system monitor
self._system_monitor = SystemMonitor(
self._settings,
self._interface,
)
if not self._settings._disable_stats:
self._system_monitor.start()
if not self._settings._disable_meta and not run_start.run.resumed:
self._system_monitor.probe(publish=True)
self._tb_watcher = tb_watcher.TBWatcher(
self._settings, interface=self._interface, run_proto=run_start.run
)
if run_start.run.resumed:
self._step = run_start.run.starting_step
result = proto_util._result_from_record(record)
self._respond_result(result) | python | wandb/sdk/internal/handler.py | 676 | 706 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,407 | handle_request_resume | def handle_request_resume(self, record: Record) -> None:
if self._system_monitor is not None:
logger.info("starting system metrics thread or process")
self._system_monitor.start()
if self._track_time is not None:
self._accumulate_time += time.time() - self._track_time
self._track_time = time.time() | python | wandb/sdk/internal/handler.py | 708 | 715 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,408 | handle_request_pause | def handle_request_pause(self, record: Record) -> None:
if self._system_monitor is not None:
logger.info("stopping system metrics thread or process")
self._system_monitor.finish()
if self._track_time is not None:
self._accumulate_time += time.time() - self._track_time
self._track_time = None | python | wandb/sdk/internal/handler.py | 717 | 723 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,409 | handle_request_poll_exit | def handle_request_poll_exit(self, record: Record) -> None:
self._dispatch_record(record, always_send=True) | python | wandb/sdk/internal/handler.py | 725 | 726 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,410 | handle_request_stop_status | def handle_request_stop_status(self, record: Record) -> None:
self._dispatch_record(record) | python | wandb/sdk/internal/handler.py | 728 | 729 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,411 | handle_request_network_status | def handle_request_network_status(self, record: Record) -> None:
self._dispatch_record(record) | python | wandb/sdk/internal/handler.py | 731 | 732 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,412 | handle_request_status | def handle_request_status(self, record: Record) -> None:
# TODO(mempressure): do something better?
assert record.control.req_resp
result = proto_util._result_from_record(record)
self._respond_result(result) | python | wandb/sdk/internal/handler.py | 734 | 738 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,413 | handle_request_get_summary | def handle_request_get_summary(self, record: Record) -> None:
result = proto_util._result_from_record(record)
for key, value in self._consolidated_summary.items():
item = SummaryItem()
item.key = key
item.value_json = json.dumps(value)
result.response.get_summary_response.item.append(item)
self._respond_result(result) | python | wandb/sdk/internal/handler.py | 740 | 747 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,414 | handle_tbrecord | def handle_tbrecord(self, record: Record) -> None:
logger.info("handling tbrecord: %s", record)
if self._tb_watcher:
tbrecord = record.tbrecord
self._tb_watcher.add(tbrecord.log_dir, tbrecord.save, tbrecord.root_dir)
self._dispatch_record(record) | python | wandb/sdk/internal/handler.py | 749 | 754 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,415 | _handle_defined_metric | def _handle_defined_metric(self, record: Record) -> None:
metric = record.metric
if metric._control.overwrite:
self._metric_defines[metric.name].CopyFrom(metric)
else:
self._metric_defines[metric.name].MergeFrom(metric)
# before dispatching, make sure step_metric is defined, if not define it and
# dispatch it locally first
metric = self._metric_defines[metric.name]
if metric.step_metric and metric.step_metric not in self._metric_defines:
m = MetricRecord(name=metric.step_metric)
self._metric_defines[metric.step_metric] = m
mr = Record()
mr.metric.CopyFrom(m)
mr.control.local = True # Don't store this, just send it
self._dispatch_record(mr)
self._dispatch_record(record) | python | wandb/sdk/internal/handler.py | 756 | 774 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,416 | _handle_glob_metric | def _handle_glob_metric(self, record: Record) -> None:
metric = record.metric
if metric._control.overwrite:
self._metric_globs[metric.glob_name].CopyFrom(metric)
else:
self._metric_globs[metric.glob_name].MergeFrom(metric)
self._dispatch_record(record) | python | wandb/sdk/internal/handler.py | 776 | 782 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,417 | handle_metric | def handle_metric(self, record: Record) -> None:
"""Handle MetricRecord.
Walkthrough of the life of a MetricRecord:
Metric defined:
- run.define_metric() parses arguments create wandb_metric.Metric
- build MetricRecord publish to interface
- handler (this function) keeps list of metrics published:
- self._metric_defines: Fully defined metrics
- self._metric_globs: metrics that have a wildcard
- dispatch writer and sender thread
- writer: records are saved to persistent store
- sender: fully defined metrics get mapped into metadata for UI
History logged:
- handle_history
- check if metric matches _metric_defines
- if not, check if metric matches _metric_globs
- if _metric globs match, generate defined metric and call _handle_metric
Args:
record (Record): Metric record to process
"""
if record.metric.name:
self._handle_defined_metric(record)
elif record.metric.glob_name:
self._handle_glob_metric(record) | python | wandb/sdk/internal/handler.py | 784 | 811 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,418 | handle_request_sampled_history | def handle_request_sampled_history(self, record: Record) -> None:
result = proto_util._result_from_record(record)
for key, sampled in self._sampled_history.items():
item = SampledHistoryItem()
item.key = key
values: Iterable[Any] = sampled.get()
if all(isinstance(i, numbers.Integral) for i in values):
item.values_int.extend(values)
elif all(isinstance(i, numbers.Real) for i in values):
item.values_float.extend(values)
result.response.sampled_history_response.item.append(item)
self._respond_result(result) | python | wandb/sdk/internal/handler.py | 813 | 824 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,419 | handle_request_server_info | def handle_request_server_info(self, record: Record) -> None:
self._dispatch_record(record, always_send=True) | python | wandb/sdk/internal/handler.py | 826 | 827 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,420 | handle_request_keepalive | def handle_request_keepalive(self, record: Record) -> None:
"""Handle a keepalive request.
Keepalive is a noop, we just want to verify transport is alive.
""" | python | wandb/sdk/internal/handler.py | 829 | 833 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,421 | handle_request_run_status | def handle_request_run_status(self, record: Record) -> None:
self._dispatch_record(record, always_send=True) | python | wandb/sdk/internal/handler.py | 835 | 836 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,422 | handle_request_shutdown | def handle_request_shutdown(self, record: Record) -> None:
# TODO(jhr): should we drain things and stop new requests from coming in?
result = proto_util._result_from_record(record)
self._respond_result(result)
self._stopped.set() | python | wandb/sdk/internal/handler.py | 838 | 842 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,423 | finish | def finish(self) -> None:
logger.info("shutting down handler")
if self._system_monitor is not None:
self._system_monitor.finish()
if self._tb_watcher:
self._tb_watcher.finish()
# self._context_keeper._debug_print_orphans() | python | wandb/sdk/internal/handler.py | 844 | 850 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,424 | __next__ | def __next__(self) -> Record:
return self._record_q.get(block=True) | python | wandb/sdk/internal/handler.py | 852 | 853 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,425 | _history_assign_runtime | def _history_assign_runtime(
self,
history: HistoryRecord,
history_dict: Dict[str, Any],
) -> None:
# _runtime calculation is meaningless if there is no _timestamp
if "_timestamp" not in history_dict:
return
# if it is offline sync, self._run_start_time is None
# in that case set it to the first tfevent timestamp
if self._run_start_time is None:
self._run_start_time = history_dict["_timestamp"]
history_dict["_runtime"] = history_dict["_timestamp"] - self._run_start_time
item = history.item.add()
item.key = "_runtime"
item.value_json = json.dumps(history_dict[item.key]) | python | wandb/sdk/internal/handler.py | 857 | 872 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,426 | __init__ | def __init__(self, d: "SettingsDict") -> None:
object.__setattr__(self, "__dict__", d) | python | wandb/sdk/internal/settings_static.py | 70 | 71 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,427 | __setattr__ | def __setattr__(self, name: str, value: object) -> None:
raise AttributeError("Error: SettingsStatic is a readonly object") | python | wandb/sdk/internal/settings_static.py | 73 | 74 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,428 | __setitem__ | def __setitem__(self, key: str, val: object) -> None:
raise AttributeError("Error: SettingsStatic is a readonly object") | python | wandb/sdk/internal/settings_static.py | 76 | 77 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,429 | keys | def keys(self) -> "Iterable[str]":
return self.__dict__.keys() | python | wandb/sdk/internal/settings_static.py | 79 | 80 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,430 | items | def items(self) -> "Iterable[Any]":
return self.__dict__.items() | python | wandb/sdk/internal/settings_static.py | 82 | 83 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,431 | __getitem__ | def __getitem__(self, key: str) -> "Any":
return self.__dict__[key] | python | wandb/sdk/internal/settings_static.py | 85 | 86 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,432 | __str__ | def __str__(self) -> str:
return str(self.__dict__) | python | wandb/sdk/internal/settings_static.py | 88 | 89 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,433 | __contains__ | def __contains__(self, key: str) -> bool:
return key in self.__dict__ | python | wandb/sdk/internal/settings_static.py | 91 | 92 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,434 | get | def get(self, key: str, default: Optional[Any] = None) -> Any:
return self.__dict__.get(key, default) | python | wandb/sdk/internal/settings_static.py | 94 | 95 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,435 | _link_and_save_file | def _link_and_save_file(
path: str, base_path: str, interface: "InterfaceQueue", settings: "SettingsStatic"
) -> None:
# TODO(jhr): should this logic be merged with Run.save()
files_dir = settings.files_dir
file_name = os.path.relpath(path, base_path)
abs_path = os.path.abspath(path)
wandb_path = os.path.join(files_dir, file_name)
filesystem.mkdir_exists_ok(os.path.dirname(wandb_path))
# We overwrite existing symlinks because namespaces can change in Tensorboard
if os.path.islink(wandb_path) and abs_path != os.readlink(wandb_path):
os.remove(wandb_path)
os.symlink(abs_path, wandb_path)
elif not os.path.exists(wandb_path):
os.symlink(abs_path, wandb_path)
# TODO(jhr): need to figure out policy, live/throttled?
interface.publish_files(dict(files=[(GlobStr(glob.escape(file_name)), "live")])) | python | wandb/sdk/internal/tb_watcher.py | 42 | 58 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,436 | is_tfevents_file_created_by | def is_tfevents_file_created_by(path: str, hostname: str, start_time: float) -> bool:
"""Check if a path is a tfevents file created by hostname.
tensorboard tfevents filename format:
https://github.com/tensorflow/tensorboard/blob/f3f26b46981da5bd46a5bb93fcf02d9eb7608bc1/tensorboard/summary/writer/event_file_writer.py#L81
tensorflow tfevents fielname format:
https://github.com/tensorflow/tensorflow/blob/8f597046dc30c14b5413813d02c0e0aed399c177/tensorflow/core/util/events_writer.cc#L68
"""
if not path:
raise ValueError("Path must be a nonempty string")
basename = os.path.basename(path)
if basename.endswith(".profile-empty") or basename.endswith(".sagemaker-uploaded"):
return False
fname_components = basename.split(".")
try:
tfevents_idx = fname_components.index("tfevents")
except ValueError:
return False
# check the hostname, which may have dots
for i, part in enumerate(hostname.split(".")):
try:
fname_component_part = fname_components[tfevents_idx + 2 + i]
except IndexError:
return False
if part != fname_component_part:
return False
try:
created_time = int(fname_components[tfevents_idx + 1])
except (ValueError, IndexError):
return False
# Ensure that the file is newer then our start time, and that it was
# created from the same hostname.
# TODO: we should also check the PID (also contained in the tfevents
# filename). Can we assume that our parent pid is the user process
# that wrote these files?
return created_time >= int(start_time) | python | wandb/sdk/internal/tb_watcher.py | 61 | 96 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,437 | __init__ | def __init__(
self,
settings: "SettingsStatic",
run_proto: "RunRecord",
interface: "InterfaceQueue",
force: bool = False,
) -> None:
self._logdirs = {}
self._consumer: Optional["TBEventConsumer"] = None
self._settings = settings
self._interface = interface
self._run_proto = run_proto
self._force = force
# TODO(jhr): do we need locking in this queue?
self._watcher_queue = queue.PriorityQueue()
wandb.tensorboard.reset_state() | python | wandb/sdk/internal/tb_watcher.py | 103 | 118 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,438 | _calculate_namespace | def _calculate_namespace(self, logdir: str, rootdir: str) -> Optional[str]:
namespace: Optional[str]
dirs = list(self._logdirs) + [logdir]
if os.path.isfile(logdir):
filename = os.path.basename(logdir)
else:
filename = ""
if rootdir == "":
rootdir = util.to_forward_slash_path(
os.path.dirname(os.path.commonprefix(dirs))
)
# Tensorboard loads all tfevents files in a directory and prepends
# their values with the path. Passing namespace to log allows us
# to nest the values in wandb
# Note that we strip '/' instead of os.sep, because elsewhere we've
# converted paths to forward slash.
namespace = logdir.replace(filename, "").replace(rootdir, "").strip("/")
# TODO: revisit this heuristic, it exists because we don't know the
# root log directory until more than one tfevents file is written to
if len(dirs) == 1 and namespace not in ["train", "validation"]:
namespace = None
else:
namespace = logdir.replace(filename, "").replace(rootdir, "").strip("/")
return namespace | python | wandb/sdk/internal/tb_watcher.py | 120 | 146 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,439 | add | def add(self, logdir: str, save: bool, root_dir: str) -> None:
logdir = util.to_forward_slash_path(logdir)
root_dir = util.to_forward_slash_path(root_dir)
if logdir in self._logdirs:
return
namespace = self._calculate_namespace(logdir, root_dir)
# TODO(jhr): implement the deferred tbdirwatcher to find namespace
if not self._consumer:
self._consumer = TBEventConsumer(
self, self._watcher_queue, self._run_proto, self._settings
)
self._consumer.start()
tbdir_watcher = TBDirWatcher(
self, logdir, save, namespace, self._watcher_queue, self._force
)
self._logdirs[logdir] = tbdir_watcher
tbdir_watcher.start() | python | wandb/sdk/internal/tb_watcher.py | 148 | 166 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,440 | finish | def finish(self) -> None:
for tbdirwatcher in self._logdirs.values():
tbdirwatcher.shutdown()
for tbdirwatcher in self._logdirs.values():
tbdirwatcher.finish()
if self._consumer:
self._consumer.finish() | python | wandb/sdk/internal/tb_watcher.py | 168 | 174 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,441 | __init__ | def __init__(
self,
tbwatcher: "TBWatcher",
logdir: str,
save: bool,
namespace: Optional[str],
queue: "PriorityQueue",
force: bool = False,
) -> None:
self.directory_watcher = util.get_module(
"tensorboard.backend.event_processing.directory_watcher",
required="Please install tensorboard package",
)
# self.event_file_loader = util.get_module(
# "tensorboard.backend.event_processing.event_file_loader",
# required="Please install tensorboard package",
# )
self.tf_compat = util.get_module(
"tensorboard.compat", required="Please install tensorboard package"
)
self._tbwatcher = tbwatcher
self._generator = self.directory_watcher.DirectoryWatcher(
logdir, self._loader(save, namespace), self._is_our_tfevents_file
)
self._thread = threading.Thread(target=self._thread_except_body)
self._first_event_timestamp = None
self._shutdown = threading.Event()
self._queue = queue
self._file_version = None
self._namespace = namespace
self._logdir = logdir
self._hostname = socket.gethostname()
self._force = force
self._process_events_lock = threading.Lock() | python | wandb/sdk/internal/tb_watcher.py | 178 | 211 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,442 | start | def start(self) -> None:
self._thread.start() | python | wandb/sdk/internal/tb_watcher.py | 213 | 214 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,443 | _is_our_tfevents_file | def _is_our_tfevents_file(self, path: str) -> bool:
"""Check if a path has been modified since launch and contains tfevents."""
if not path:
raise ValueError("Path must be a nonempty string")
if self._force:
return True
path = self.tf_compat.tf.compat.as_str_any(path)
return is_tfevents_file_created_by(
path, self._hostname, self._tbwatcher._settings._start_time
) | python | wandb/sdk/internal/tb_watcher.py | 216 | 225 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,444 | _loader | def _loader(
self, save: bool = True, namespace: Optional[str] = None
) -> "EventFileLoader":
"""Incredibly hacky class generator to optionally save / prefix tfevent files."""
_loader_interface = self._tbwatcher._interface
_loader_settings = self._tbwatcher._settings
try:
from tensorboard.backend.event_processing import event_file_loader
except ImportError:
raise Exception("Please install tensorboard package")
class EventFileLoader(event_file_loader.EventFileLoader):
def __init__(self, file_path: str) -> None:
super().__init__(file_path)
if save:
if REMOTE_FILE_TOKEN in file_path:
logger.warning(
"Not persisting remote tfevent file: %s", file_path
)
else:
# TODO: save plugins?
logdir = os.path.dirname(file_path)
parts = list(os.path.split(logdir))
if namespace and parts[-1] == namespace:
parts.pop()
logdir = os.path.join(*parts)
_link_and_save_file(
path=file_path,
base_path=logdir,
interface=_loader_interface,
settings=_loader_settings,
)
return EventFileLoader | python | wandb/sdk/internal/tb_watcher.py | 227 | 260 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,445 | __init__ | def __init__(self, file_path: str) -> None:
super().__init__(file_path)
if save:
if REMOTE_FILE_TOKEN in file_path:
logger.warning(
"Not persisting remote tfevent file: %s", file_path
)
else:
# TODO: save plugins?
logdir = os.path.dirname(file_path)
parts = list(os.path.split(logdir))
if namespace and parts[-1] == namespace:
parts.pop()
logdir = os.path.join(*parts)
_link_and_save_file(
path=file_path,
base_path=logdir,
interface=_loader_interface,
settings=_loader_settings,
) | python | wandb/sdk/internal/tb_watcher.py | 239 | 258 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,446 | _process_events | def _process_events(self, shutdown_call: bool = False) -> None:
try:
with self._process_events_lock:
for event in self._generator.Load():
self.process_event(event)
except (
self.directory_watcher.DirectoryDeletedError,
StopIteration,
RuntimeError,
OSError,
) as e:
# When listing s3 the directory may not yet exist, or could be empty
logger.debug("Encountered tensorboard directory watcher error: %s", e)
if not self._shutdown.is_set() and not shutdown_call:
time.sleep(ERROR_DELAY) | python | wandb/sdk/internal/tb_watcher.py | 262 | 276 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,447 | _thread_except_body | def _thread_except_body(self) -> None:
try:
self._thread_body()
except Exception as e:
logger.exception("generic exception in TBDirWatcher thread")
raise e | python | wandb/sdk/internal/tb_watcher.py | 278 | 283 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,448 | _thread_body | def _thread_body(self) -> None:
"""Check for new events every second."""
shutdown_time: Optional[float] = None
while True:
self._process_events()
if self._shutdown.is_set():
now = time.time()
if not shutdown_time:
shutdown_time = now + SHUTDOWN_DELAY
elif now > shutdown_time:
break
time.sleep(1) | python | wandb/sdk/internal/tb_watcher.py | 285 | 296 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,449 | process_event | def process_event(self, event: "ProtoEvent") -> None:
# print("\nEVENT:::", self._logdir, self._namespace, event, "\n")
if self._first_event_timestamp is None:
self._first_event_timestamp = event.wall_time
if event.HasField("file_version"):
self._file_version = event.file_version
if event.HasField("summary"):
self._queue.put(Event(event, self._namespace)) | python | wandb/sdk/internal/tb_watcher.py | 298 | 307 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,450 | shutdown | def shutdown(self) -> None:
self._process_events(shutdown_call=True)
self._shutdown.set() | python | wandb/sdk/internal/tb_watcher.py | 309 | 311 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,451 | finish | def finish(self) -> None:
self.shutdown()
self._thread.join() | python | wandb/sdk/internal/tb_watcher.py | 313 | 315 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,452 | __init__ | def __init__(self, event: "ProtoEvent", namespace: Optional[str]):
self.event = event
self.namespace = namespace
self.created_at = time.time() | python | wandb/sdk/internal/tb_watcher.py | 321 | 324 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,453 | __lt__ | def __lt__(self, other: "Event") -> bool:
if self.event.wall_time < other.event.wall_time:
return True
return False | python | wandb/sdk/internal/tb_watcher.py | 326 | 329 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,454 | __init__ | def __init__(
self,
tbwatcher: TBWatcher,
queue: "PriorityQueue",
run_proto: "RunRecord",
settings: "SettingsStatic",
delay: int = 10,
) -> None:
self._tbwatcher = tbwatcher
self._queue = queue
self._thread = threading.Thread(target=self._thread_except_body)
self._shutdown = threading.Event()
self.tb_history = TBHistory()
self._delay = delay
# This is a bit of a hack to get file saving to work as it does in the user
# process. Since we don't have a real run object, we have to define the
# datatypes callback ourselves.
def datatypes_cb(fname: GlobStr) -> None:
files: "FilesDict" = dict(files=[(fname, "now")])
self._tbwatcher._interface.publish_files(files)
# this is only used for logging artifacts
self._internal_run = internal_run.InternalRun(run_proto, settings, datatypes_cb)
self._internal_run._set_internal_run_interface(self._tbwatcher._interface) | python | wandb/sdk/internal/tb_watcher.py | 340 | 364 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,455 | datatypes_cb | def datatypes_cb(fname: GlobStr) -> None:
files: "FilesDict" = dict(files=[(fname, "now")])
self._tbwatcher._interface.publish_files(files) | python | wandb/sdk/internal/tb_watcher.py | 358 | 360 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,456 | start | def start(self) -> None:
self._start_time = time.time()
self._thread.start() | python | wandb/sdk/internal/tb_watcher.py | 366 | 368 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,457 | finish | def finish(self) -> None:
self._delay = 0
self._shutdown.set()
self._thread.join()
while not self._queue.empty():
event = self._queue.get(True, 1)
if event:
self._handle_event(event, history=self.tb_history)
items = self.tb_history._get_and_reset()
for item in items:
self._save_row(
item,
) | python | wandb/sdk/internal/tb_watcher.py | 370 | 382 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,458 | _thread_except_body | def _thread_except_body(self) -> None:
try:
self._thread_body()
except Exception as e:
logger.exception("generic exception in TBEventConsumer thread")
raise e | python | wandb/sdk/internal/tb_watcher.py | 384 | 389 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,459 | _thread_body | def _thread_body(self) -> None:
while True:
try:
event = self._queue.get(True, 1)
# Wait self._delay seconds from consumer start before logging events
if (
time.time() < self._start_time + self._delay
and not self._shutdown.is_set()
):
self._queue.put(event)
time.sleep(0.1)
continue
except queue.Empty:
event = None
if self._shutdown.is_set():
break
if event:
self._handle_event(event, history=self.tb_history)
items = self.tb_history._get_and_reset()
for item in items:
self._save_row(
item,
)
# flush uncommitted data
self.tb_history._flush()
items = self.tb_history._get_and_reset()
for item in items:
self._save_row(item) | python | wandb/sdk/internal/tb_watcher.py | 391 | 418 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,460 | _handle_event | def _handle_event(
self, event: "ProtoEvent", history: Optional["TBHistory"] = None
) -> None:
wandb.tensorboard._log(
event.event,
step=event.event.step,
namespace=event.namespace,
history=history,
) | python | wandb/sdk/internal/tb_watcher.py | 420 | 428 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,461 | _save_row | def _save_row(self, row: "HistoryDict") -> None:
chart_keys = set()
for k in row:
if isinstance(row[k], CustomChart):
chart_keys.add(k)
key = row[k].get_config_key(k)
value = row[k].get_config_value(
"Vega2", row[k].user_query(f"{k}_table")
)
row[k] = row[k]._data
self._tbwatcher._interface.publish_config(val=value, key=key)
for k in chart_keys:
row[f"{k}_table"] = row.pop(k)
self._tbwatcher._interface.publish_history(
row, run=self._internal_run, publish_step=False
) | python | wandb/sdk/internal/tb_watcher.py | 430 | 447 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,462 | __init__ | def __init__(self) -> None:
self._step = 0
self._step_size = 0
self._data = dict()
self._added = [] | python | wandb/sdk/internal/tb_watcher.py | 454 | 458 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,463 | _flush | def _flush(self) -> None:
if not self._data:
return
# A single tensorboard step may have too much data
# we just drop the largest keys in the step if it does.
# TODO: we could flush the data across multiple steps
if self._step_size > util.MAX_LINE_BYTES:
metrics = [(k, sys.getsizeof(v)) for k, v in self._data.items()]
metrics.sort(key=lambda t: t[1], reverse=True)
bad = 0
dropped_keys = []
for k, v in metrics:
# TODO: (cvp) Added a buffer of 100KiB, this feels rather brittle.
if self._step_size - bad < util.MAX_LINE_BYTES - 100000:
break
else:
bad += v
dropped_keys.append(k)
del self._data[k]
wandb.termwarn(
"Step {} exceeds max data limit, dropping {} of the largest keys:".format(
self._step, len(dropped_keys)
)
)
print("\t" + ("\n\t".join(dropped_keys)))
self._data["_step"] = self._step
self._added.append(self._data)
self._step += 1
self._step_size = 0 | python | wandb/sdk/internal/tb_watcher.py | 460 | 488 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,464 | add | def add(self, d: "HistoryDict") -> None:
self._flush()
self._data = dict()
self._data.update(self._track_history_dict(d)) | python | wandb/sdk/internal/tb_watcher.py | 490 | 493 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,465 | _track_history_dict | def _track_history_dict(self, d: "HistoryDict") -> "HistoryDict":
e = {}
for k in d.keys():
e[k] = d[k]
self._step_size += sys.getsizeof(e[k])
return e | python | wandb/sdk/internal/tb_watcher.py | 495 | 500 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,466 | _row_update | def _row_update(self, d: "HistoryDict") -> None:
self._data.update(self._track_history_dict(d)) | python | wandb/sdk/internal/tb_watcher.py | 502 | 503 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,467 | _get_and_reset | def _get_and_reset(self) -> "List[HistoryDict]":
added = self._added[:]
self._added = []
return added | python | wandb/sdk/internal/tb_watcher.py | 505 | 508 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,468 | _get_request_type | def _get_request_type(record: "Record") -> Optional[str]:
record_type = record.WhichOneof("record_type")
if record_type != "request":
return None
request_type = record.request.WhichOneof("request_type")
return request_type | python | wandb/sdk/internal/flow_control.py | 48 | 53 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,469 | _is_control_record | def _is_control_record(record: "Record") -> bool:
return record.control.flow_control | python | wandb/sdk/internal/flow_control.py | 56 | 57 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,470 | _is_local_non_control_record | def _is_local_non_control_record(record: "Record") -> bool:
return record.control.local and not record.control.flow_control | python | wandb/sdk/internal/flow_control.py | 60 | 61 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,471 | __init__ | def __init__(
self,
settings: SettingsStatic,
forward_record: Callable[["Record"], None],
write_record: Callable[["Record"], int],
pause_marker: Callable[[], None],
recover_records: Callable[[int, int], None],
_threshold_bytes_high: int = 0,
_threshold_bytes_mid: int = 0,
_threshold_bytes_low: int = 0,
) -> None:
# thresholds to define when to PAUSE, RESTART, FORWARDING
if (
_threshold_bytes_high == 0
or _threshold_bytes_mid == 0
or _threshold_bytes_low == 0
):
threshold = settings._network_buffer or DEFAULT_THRESHOLD
_threshold_bytes_high = threshold
_threshold_bytes_mid = threshold // 2
_threshold_bytes_low = threshold // 4
assert _threshold_bytes_high > _threshold_bytes_mid > _threshold_bytes_low
# FSM definition
state_forwarding = StateForwarding(
forward_record=forward_record,
pause_marker=pause_marker,
threshold_pause=_threshold_bytes_high,
)
state_pausing = StatePausing(
forward_record=forward_record,
recover_records=recover_records,
threshold_recover=_threshold_bytes_mid,
threshold_forward=_threshold_bytes_low,
)
self._fsm = fsm.FsmWithContext(
states=[state_forwarding, state_pausing],
table={
StateForwarding: [
fsm.FsmEntry(
state_forwarding._should_pause,
StatePausing,
state_forwarding._pause,
),
],
StatePausing: [
fsm.FsmEntry(
state_pausing._should_unpause,
StateForwarding,
state_pausing._unpause,
),
fsm.FsmEntry(
state_pausing._should_recover,
StatePausing,
state_pausing._recover,
),
fsm.FsmEntry(
state_pausing._should_quiesce,
StatePausing,
state_pausing._quiesce,
),
],
},
) | python | wandb/sdk/internal/flow_control.py | 74 | 138 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,472 | flush | def flush(self) -> None:
# TODO(mempressure): what do we do here, how do we make sure we dont have work in pause state
pass | python | wandb/sdk/internal/flow_control.py | 140 | 142 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,473 | flow | def flow(self, record: "Record") -> None:
self._fsm.input(record) | python | wandb/sdk/internal/flow_control.py | 144 | 145 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,474 | __init__ | def __init__(self) -> None:
self._context = StateContext() | python | wandb/sdk/internal/flow_control.py | 151 | 152 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,475 | _update_written_offset | def _update_written_offset(self, record: "Record") -> None:
end_offset = record.control.end_offset
if end_offset:
self._context.last_written_offset = end_offset | python | wandb/sdk/internal/flow_control.py | 154 | 157 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,476 | _update_forwarded_offset | def _update_forwarded_offset(self) -> None:
self._context.last_forwarded_offset = self._context.last_written_offset | python | wandb/sdk/internal/flow_control.py | 159 | 160 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,477 | _process | def _process(self, record: "Record") -> None:
request_type = _get_request_type(record)
if not request_type:
return
process_str = f"_process_{request_type}"
process_handler: Optional[Callable[["pb.Record"], None]] = getattr(
self, process_str, None
)
if not process_handler:
return
process_handler(record) | python | wandb/sdk/internal/flow_control.py | 162 | 172 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,478 | _process_status_report | def _process_status_report(self, record: "Record") -> None:
sent_offset = record.request.status_report.sent_offset
self._context.last_sent_offset = sent_offset | python | wandb/sdk/internal/flow_control.py | 174 | 176 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,479 | on_exit | def on_exit(self, record: "Record") -> StateContext:
return self._context | python | wandb/sdk/internal/flow_control.py | 178 | 179 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,480 | on_enter | def on_enter(self, record: "Record", context: StateContext) -> None:
self._context = context | python | wandb/sdk/internal/flow_control.py | 181 | 182 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,481 | _behind_bytes | def _behind_bytes(self) -> int:
return self._context.last_forwarded_offset - self._context.last_sent_offset | python | wandb/sdk/internal/flow_control.py | 185 | 186 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,482 | __init__ | def __init__(
self,
forward_record: Callable[["Record"], None],
pause_marker: Callable[[], None],
threshold_pause: int,
) -> None:
super().__init__()
self._forward_record = forward_record
self._pause_marker = pause_marker
self._threshold_pause = threshold_pause | python | wandb/sdk/internal/flow_control.py | 194 | 203 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,483 | _should_pause | def _should_pause(self, record: "Record") -> bool:
return self._behind_bytes >= self._threshold_pause | python | wandb/sdk/internal/flow_control.py | 205 | 206 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,484 | _pause | def _pause(self, record: "Record") -> None:
self._pause_marker() | python | wandb/sdk/internal/flow_control.py | 208 | 209 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,485 | on_check | def on_check(self, record: "Record") -> None:
self._update_written_offset(record)
self._process(record)
if not _is_control_record(record):
self._forward_record(record)
self._update_forwarded_offset() | python | wandb/sdk/internal/flow_control.py | 211 | 216 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,486 | __init__ | def __init__(
self,
forward_record: Callable[["Record"], None],
recover_records: Callable[[int, int], None],
threshold_recover: int,
threshold_forward: int,
) -> None:
super().__init__()
self._forward_record = forward_record
self._recover_records = recover_records
self._threshold_recover = threshold_recover
self._threshold_forward = threshold_forward | python | wandb/sdk/internal/flow_control.py | 225 | 236 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,487 | _should_unpause | def _should_unpause(self, record: "Record") -> bool:
return self._behind_bytes < self._threshold_forward | python | wandb/sdk/internal/flow_control.py | 238 | 239 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,488 | _unpause | def _unpause(self, record: "Record") -> None:
self._quiesce(record) | python | wandb/sdk/internal/flow_control.py | 241 | 242 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,489 | _should_recover | def _should_recover(self, record: "Record") -> bool:
return self._behind_bytes < self._threshold_recover | python | wandb/sdk/internal/flow_control.py | 244 | 245 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,490 | _recover | def _recover(self, record: "Record") -> None:
self._quiesce(record) | python | wandb/sdk/internal/flow_control.py | 247 | 248 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,491 | _should_quiesce | def _should_quiesce(self, record: "Record") -> bool:
return _is_local_non_control_record(record) | python | wandb/sdk/internal/flow_control.py | 250 | 251 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,492 | _quiesce | def _quiesce(self, record: "Record") -> None:
start = self._context.last_forwarded_offset
end = self._context.last_written_offset
if start != end:
self._recover_records(start, end)
if _is_local_non_control_record(record):
self._forward_record(record)
self._update_forwarded_offset() | python | wandb/sdk/internal/flow_control.py | 253 | 260 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,493 | on_check | def on_check(self, record: "Record") -> None:
self._update_written_offset(record)
self._process(record) | python | wandb/sdk/internal/flow_control.py | 262 | 264 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,494 | __init__ | def __init__(self) -> None:
self._cancel_event = threading.Event()
# TODO(debug_context) see above
# self._debug_record = None | python | wandb/sdk/internal/context.py | 17 | 20 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,495 | cancel | def cancel(self) -> None:
self._cancel_event.set() | python | wandb/sdk/internal/context.py | 22 | 23 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,496 | cancel_event | def cancel_event(self) -> threading.Event:
return self._cancel_event | python | wandb/sdk/internal/context.py | 26 | 27 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,497 | context_id_from_record | def context_id_from_record(record: Record) -> str:
context_id = record.control.mailbox_slot
return context_id | python | wandb/sdk/internal/context.py | 30 | 32 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,498 | context_id_from_result | def context_id_from_result(result: Result) -> str:
context_id = result.control.mailbox_slot
return context_id | python | wandb/sdk/internal/context.py | 35 | 37 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,499 | __init__ | def __init__(self) -> None:
self._active_items = {} | python | wandb/sdk/internal/context.py | 43 | 44 | {
"name": "Git-abouvier/wandb",
"url": "https://github.com/Git-abouvier/wandb.git",
"license": "MIT",
"stars": 0,
"forks": 0
} |
4,500 | add_from_record | def add_from_record(self, record: Record) -> Optional[Context]:
context_id = context_id_from_record(record)
if not context_id:
return None
context_obj = self.add(context_id)
# TODO(debug_context) see above
# context_obj._debug_record = record
return context_obj | python | wandb/sdk/internal/context.py | 46 | 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.