Beispiel #1
0
    def execute(self, server_info, channel):
        api_client = export_service_pb2_grpc.TensorBoardExporterServiceStub(
            channel)
        fieldmask = experiment_pb2.ExperimentMask(
            name=True,
            description=True,
            create_time=True,
            update_time=True,
            num_runs=True,
            num_tags=True,
            num_scalars=True,
            total_tensor_bytes=True,
            total_blob_bytes=True,
        )
        gen = exporter_lib.list_experiments(api_client, fieldmask=fieldmask)
        count = 0

        if self.json:
            formatter = formatters.JsonFormatter()
        else:
            formatter = formatters.ReadableFormatter()
        for experiment in gen:
            count += 1
            experiment_id = experiment.experiment_id
            url = server_info_lib.experiment_url(server_info, experiment_id)
            print(formatter.format_experiment(experiment, url))
        sys.stdout.flush()
        if not count:
            sys.stderr.write(
                "No experiments. Use `tensorboard dev upload` to get started.\n"
            )
        else:
            sys.stderr.write("Total: %d experiment(s)\n" % count)
        sys.stderr.flush()
Beispiel #2
0
 def execute(self, server_info, channel):
     api_client = write_service_pb2_grpc.TensorBoardWriterServiceStub(
         channel
     )
     _die_if_bad_experiment_name(self.name)
     _die_if_bad_experiment_description(self.description)
     uploader = uploader_lib.TensorBoardUploader(
         api_client,
         self.logdir,
         name=self.name,
         description=self.description,
     )
     experiment_id = uploader.create_experiment()
     url = server_info_lib.experiment_url(server_info, experiment_id)
     print(
         "Upload started and will continue reading any new data as it's added"
     )
     print("to the logdir. To stop uploading, press Ctrl-C.")
     print("View your TensorBoard live at: %s" % url)
     try:
         uploader.start_uploading()
     except uploader_lib.ExperimentNotFoundError:
         print("Experiment was deleted; uploading has been cancelled")
         return
     except KeyboardInterrupt:
         print()
         print("Upload stopped. View your TensorBoard at %s" % url)
         return
     # TODO(@nfelt): make it possible for the upload cycle to end once we
     #   detect that no more runs are active, so this code can be reached.
     print("Done! View your TensorBoard at %s" % url)
Beispiel #3
0
 def execute(self, server_info, channel):
     if self.dry_run:
         api_client = dry_run_stubs.DryRunTensorBoardWriterStub()
     else:
         api_client = write_service_pb2_grpc.TensorBoardWriterServiceStub(
             channel
         )
     _die_if_bad_experiment_name(self.name)
     _die_if_bad_experiment_description(self.description)
     uploader = uploader_lib.TensorBoardUploader(
         api_client,
         self.logdir,
         allowed_plugins=server_info_lib.allowed_plugins(server_info),
         upload_limits=server_info_lib.upload_limits(server_info),
         name=self.name,
         description=self.description,
         verbosity=self.verbosity,
         one_shot=self.one_shot,
     )
     if self.one_shot and not os.path.isdir(self.logdir):
         print("%s: No such directory." % self.logdir)
         print(
             "User specified `one_shot` mode with an unavailable "
             "logdir. Exiting without creating an experiment."
         )
         return
     experiment_id = uploader.create_experiment()
     url = server_info_lib.experiment_url(server_info, experiment_id)
     if self.experiment_url_callback is not None:
         self.experiment_url_callback(url)
     print(
         "Upload started and will continue reading any new data as it's "
         "added to the logdir.\n\nTo stop uploading, press Ctrl-C."
     )
     if self.dry_run:
         print(
             "\n** This is a dry run. "
             "No data will be sent to tensorboard.dev. **\n"
         )
     else:
         print("\nView your TensorBoard live at: %s\n" % url)
     interrupted = False
     try:
         uploader.start_uploading()
     except uploader_lib.ExperimentNotFoundError:
         print("Experiment was deleted; uploading has been cancelled")
         return
     except KeyboardInterrupt:
         interrupted = True
     finally:
         end_message = "\n"
         if interrupted:
             end_message += "Interrupted."
         else:
             end_message += "Done."
         if not self.dry_run:
             end_message += " View your TensorBoard at %s" % url
         sys.stdout.write(end_message + "\n")
         sys.stdout.flush()
Beispiel #4
0
 def execute(self, server_info, channel):
     api_client = export_service_pb2_grpc.TensorBoardExporterServiceStub(
         channel
     )
     fieldmask = experiment_pb2.ExperimentMask(
         create_time=True,
         update_time=True,
         num_scalars=True,
         num_runs=True,
         num_tags=True,
     )
     gen = exporter_lib.list_experiments(api_client, fieldmask=fieldmask)
     count = 0
     for experiment in gen:
         count += 1
         if not isinstance(experiment, experiment_pb2.Experiment):
             url = server_info_lib.experiment_url(server_info, experiment)
             print(url)
             continue
         experiment_id = experiment.experiment_id
         url = server_info_lib.experiment_url(server_info, experiment_id)
         print(url)
         data = [
             ("Name", experiment.name or "[No Name]"),
             ("Description", experiment.description or "[No Description]"),
             ("Id", experiment.experiment_id),
             ("Created", util.format_time(experiment.create_time)),
             ("Updated", util.format_time(experiment.update_time)),
             ("Scalars", str(experiment.num_scalars)),
             ("Runs", str(experiment.num_runs)),
             ("Tags", str(experiment.num_tags)),
         ]
         for (name, value) in data:
             print("\t%s %s" % (name.ljust(12), value))
     sys.stdout.flush()
     if not count:
         sys.stderr.write(
             "No experiments. Use `tensorboard dev upload` to get started.\n"
         )
     else:
         sys.stderr.write("Total: %d experiment(s)\n" % count)
     sys.stderr.flush()
Beispiel #5
0
 def execute(self, server_info, channel):
     api_client = export_service_pb2_grpc.TensorBoardExporterServiceStub(
         channel)
     fieldmask = export_service_pb2.ExperimentMask(
         create_time=True,
         update_time=True,
         num_scalars=True,
         num_runs=True,
         num_tags=True,
     )
     gen = exporter_lib.list_experiments(api_client, fieldmask=fieldmask)
     count = 0
     for experiment in gen:
         count += 1
         if not isinstance(experiment, export_service_pb2.Experiment):
             url = server_info_lib.experiment_url(server_info, experiment)
             print(url)
             continue
         experiment_id = experiment.experiment_id
         url = server_info_lib.experiment_url(server_info, experiment_id)
         print(url)
         data = [
             ('Id', experiment.experiment_id),
             ('Created', util.format_time(experiment.create_time)),
             ('Updated', util.format_time(experiment.update_time)),
             ('Scalars', str(experiment.num_scalars)),
             ('Runs', str(experiment.num_runs)),
             ('Tags', str(experiment.num_tags)),
         ]
         for (name, value) in data:
             print('\t%s %s' % (name.ljust(10), value))
     sys.stdout.flush()
     if not count:
         sys.stderr.write(
             'No experiments. Use `tensorboard dev upload` to get started.\n'
         )
     else:
         sys.stderr.write('Total: %d experiment(s)\n' % count)
     sys.stderr.flush()
Beispiel #6
0
 def execute(self, server_info, channel):
     api_client = export_service_pb2_grpc.TensorBoardExporterServiceStub(
         channel)
     gen = exporter_lib.list_experiments(api_client)
     count = 0
     for experiment_id in gen:
         count += 1
         url = server_info_lib.experiment_url(server_info, experiment_id)
         print(url)
     sys.stdout.flush()
     if not count:
         sys.stderr.write(
             'No experiments. Use `tensorboard dev upload` to get started.\n'
         )
     else:
         sys.stderr.write('Total: %d experiment(s)\n' % count)
     sys.stderr.flush()
 def execute(self, server_info, channel):
     if self.dry_run:
         api_client = dry_run_stubs.DryRunTensorBoardWriterStub()
     else:
         api_client = write_service_pb2_grpc.TensorBoardWriterServiceStub(
             channel
         )
     _die_if_bad_experiment_name(self.name)
     _die_if_bad_experiment_description(self.description)
     uploader = uploader_lib.TensorBoardUploader(
         api_client,
         self.logdir,
         allowed_plugins=server_info_lib.allowed_plugins(server_info),
         upload_limits=server_info_lib.upload_limits(server_info),
         name=self.name,
         description=self.description,
         verbosity=self.verbosity,
         one_shot=self.one_shot,
     )
     experiment_id = uploader.create_experiment()
     url = server_info_lib.experiment_url(server_info, experiment_id)
     print(
         "Upload started and will continue reading any new data as it's added"
     )
     print("to the logdir. To stop uploading, press Ctrl-C.")
     if self.dry_run:
         print(
             "\n** This is a dry run. "
             "No data will be sent to tensorboard.dev. **\n"
         )
     else:
         print("View your TensorBoard live at: %s" % url)
     try:
         uploader.start_uploading()
     except uploader_lib.ExperimentNotFoundError:
         print("Experiment was deleted; uploading has been cancelled")
         return
     except KeyboardInterrupt:
         pass
     finally:
         if not self.dry_run:
             print()
             print("Done! View your TensorBoard at %s" % url)
Beispiel #8
0
    def execute(self):
        api_client = write_service_pb2_grpc.TensorBoardWriterServiceStub(
            self.channel)

        uploader = uploader_lib.TensorBoardUploader(
            api_client,
            self.args.logdir,
            allowed_plugins=server_info_lib.allowed_plugins(self.server_info),
            name=self.args.name,
            description=self.args.description,
        )
        experiment_id = uploader.create_experiment()
        url = server_info_lib.experiment_url(self.server_info, experiment_id)

        # Blocks forever to continuously upload data from the logdir
        #print("Upload started and will continue reading any new data as it's added")
        #print("View your TensorBoard live at: %s" % url)
        #uploader.start_uploading()
        # Runs one upload cycle
        uploader._upload_once()

        return url
Beispiel #9
0
 def test(self):
     info = server_info_pb2.ServerInfoResponse()
     info.url_format.template = "https://unittest.tensorboard.dev/x/???"
     info.url_format.id_placeholder = "???"
     actual = server_info.experiment_url(info, "123")
     self.assertEqual(actual, "https://unittest.tensorboard.dev/x/123")