Exemple #1
0
 def _sync_all():
     sync_items = get_runs(
         include_online=include_online,
         include_offline=include_offline,
         include_synced=include_synced,
         exclude_globs=exclude_globs,
         include_globs=include_globs,
     )
     if not sync_items:
         wandb.termerror("Nothing to sync.")
     else:
         _sync_path(sync_items)
Exemple #2
0
 def _clean():
     if path:
         runs = list(map(get_run_from_path, path))
         if not clean_force:
             click.confirm(
                 click.style(
                     "Are you sure you want to remove %i runs?" % len(runs),
                     bold=True,
                 ),
                 abort=True,
             )
         for run in runs:
             shutil.rmtree(run.path)
         click.echo(click.style("Success!", fg="green"))
         return
     runs = get_runs(
         include_online=True,
         include_offline=True,
         include_synced=True,
         include_unsynced=False,
         exclude_globs=exclude_globs,
         include_globs=include_globs,
     )
     since = datetime.datetime.now() - datetime.timedelta(hours=clean_old_hours)
     old_runs = [run for run in runs if run.datetime < since]
     old_runs.sort(key=lambda run: run.datetime)
     if old_runs:
         click.echo(
             "Found {} runs, {} are older than {} hours".format(
                 len(runs), len(old_runs), clean_old_hours
             )
         )
         for run in old_runs:
             click.echo(run.path)
         if not clean_force:
             click.confirm(
                 click.style(
                     "Are you sure you want to remove %i runs?" % len(old_runs),
                     bold=True,
                 ),
                 abort=True,
             )
         for run in old_runs:
             shutil.rmtree(run.path)
         click.echo(click.style("Success!", fg="green"))
     else:
         click.echo(
             click.style(
                 "No runs older than %i hours found" % clean_old_hours, fg="red"
             )
         )
Exemple #3
0
 def _summary():
     sync_items = get_runs()
     synced = []
     unsynced = []
     for item in sync_items:
         (synced if item.synced else unsynced).append(item)
     if synced:
         wandb.termlog("Number of synced runs: {}".format(len(synced)))
     if unsynced:
         wandb.termlog("Number of runs to be synced: {}".format(len(unsynced)))
         if show and show < len(unsynced):
             wandb.termlog("Showing {} unsynced runs:".format(show))
         for item in unsynced[: (show or len(unsynced))]:
             wandb.termlog("  {}".format(item))
     if synced:
         if not clean:
             wandb.termlog(
                 "NOTE: use sync --clean to cleanup synced runs from local directory."
             )
     if unsynced:
         if not path and not sync_all:
             wandb.termlog("NOTE: use sync --sync-all to sync all unsynced runs.")