Skip to content
This repository has been archived by the owner on Sep 24, 2020. It is now read-only.

Commit

Permalink
add offline viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
raubitsj committed Sep 1, 2020
1 parent fc69ac1 commit 0a1f3e7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
6 changes: 4 additions & 2 deletions wandb/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,11 +371,13 @@ def init(ctx, project, entity, reset):
"--ignore", help="A comma seperated list of globs to ignore syncing with wandb."
)
@click.option("--all", is_flag=True, default=False, help="Sync all runs")
@click.option("--view", is_flag=True, default=False, help="View runs", hidden=True)
@click.option("--verbose", is_flag=True, default=False, help="Verbose", hidden=True)
@display_error
def sync(ctx, path, id, project, entity, ignore, all):
def sync(ctx, path, id, project, entity, ignore, all, view, verbose):
if ignore:
ignore = ignore.split(",")
sm = SyncManager(project=project, entity=entity, run_id=id, ignore=ignore)
sm = SyncManager(project=project, entity=entity, run_id=id, ignore=ignore, view=view, verbose=verbose,)
if not path:
# Show listing of possible paths to sync
# (if interactive, allow user to pick run to sync)
Expand Down
21 changes: 17 additions & 4 deletions wandb/sync/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@


class SyncThread(threading.Thread):
def __init__(self, sync_list, project=None, entity=None, run_id=None):
def __init__(self, sync_list, project=None, entity=None, run_id=None, view=None, verbose=None,):
threading.Thread.__init__(self)
# mark this process as internal
wandb._IS_INTERNAL_PROCESS = True
self._sync_list = sync_list
self._project = project
self._entity = entity
self._run_id = run_id
self._view = view
self._verbose = verbose

def run(self):
for sync_item in self._sync_list:
Expand Down Expand Up @@ -66,6 +68,12 @@ def run(self):
pb = wandb_internal_pb2.Record()
pb.ParseFromString(data)
record_type = pb.WhichOneof("record_type")
if self._view:
if self._verbose:
print("Record:", pb)
else:
print("Record:", record_type)
continue
if record_type == "run":
if self._run_id:
pb.run.run_id = self._run_id
Expand Down Expand Up @@ -98,13 +106,15 @@ def run(self):


class SyncManager:
def __init__(self, project=None, entity=None, run_id=None, ignore=None):
def __init__(self, project=None, entity=None, run_id=None, ignore=None, view=None, verbose=None,):
self._sync_list = []
self._thread = None
self._project = project
self._entity = entity
self._run_id = run_id
self._ignore = ignore
self._view = view
self._verbose = verbose

def status(self):
pass
Expand Down Expand Up @@ -136,10 +146,13 @@ def list(self):
def start(self):
# create a thread for each file?
self._thread = SyncThread(
self._sync_list,
sync_list=self._sync_list,
project=self._project,
entity=self._entity,
run_id=self._run_id)
run_id=self._run_id,
view=self._view,
verbose=self._verbose,
)
self._thread.start()

def is_done(self):
Expand Down

0 comments on commit 0a1f3e7

Please sign in to comment.