Example #1
0
def Run():
  """This must be called from __main__ modules main, instead of app.run().

  app.run will base its actions on its stacktrace.

  Returns:
    app.run()
  """
  return app.run()
Example #2
0
    filename = FLAGS.dir+"weights/W" + str(i) + ".txt"
    visualizing.plot_weight_matrix(nsubplot_vertical, nsubplot_horizontal,
                                   location, filename, False, "W"+str(i))

    # F
    location = 1+(nlayers-i)*nsubplot_horizontal+2
    filename = FLAGS.dir+"weights/F" + str(i) + ".txt"
    visualizing.plot_weight_matrix(nsubplot_vertical, nsubplot_horizontal,
                                   location, filename, False, "F"+str(i))

    # G
    location = 1+(nlayers-i)*nsubplot_horizontal+3
    filename = FLAGS.dir+"weights/G" + str(i) + ".txt"
    visualizing.plot_weight_matrix(nsubplot_vertical, nsubplot_horizontal,
                                   location, filename, True, "G"+str(i))

  # Last layer
  location = 1+1
  filename = FLAGS.dir+"weights/W" + str(nlayers) + ".txt"
  visualizing.plot_weight_matrix(nsubplot_vertical, nsubplot_horizontal,
                                 location, filename, False, "W"+str(nlayers))

  pylab.savefig(FLAGS.dir + "weights" + ".png")

  # Make pictures with examples and representations
  visualizing.visualize_representations(FLAGS.dir, nlayers)


if __name__ == '__main__':
  app.run()
  reset_index.SetResetStatusCacheTimeout(FLAGS.reset_status_cache_timeout)

  as = adminrunner_server.AdminRunnerServer(FLAGS.enthome,
                                            FLAGS.installstate,
                                            FLAGS.port,
                                            FLAGS.box_keys_dir,
                                            FLAGS.license_keys_dir)

  # make sure we have been given a config file
  if (not as.cfg.getGlobalParam(C.ENT_SYSTEM_HAS_VALID_CONFIG) and
      as.cfg.getInstallState() != 'INSTALL'):
    logging.fatal("adminrunner doesn't have a config file; you must "\
                  "install a conf rpm or run it with "\
                  "--installstate=INSTALL (for migration)")
    return # just in case fatal doesn't exit

  ###########################################################################
  # do some startup work; this needs to run while the server is running, so
  # it needs to run in it's own thread
  startup_thread = threading.Thread(target=StartupWork,
                                    args=(as.cfg, as.cfg.getInstallState(),))
  startup_thread.start()

  ###########################################################################

  as.Loop()

if __name__ == '__main__':
  app.run()
def update_goldens(kind, output_postfix):
    golden_base = _GOLDEN_FILES_BASE_PATH % kind
    output_base = _PROTO_OUTPUT_BASE_PATH % kind
    proto_names = find_folders(golden_base)
    remove_old_files(golden_base)
    files = []
    for proto_name in proto_names:
        print("Updating %s" % proto_name)
        output = output_base + proto_name + output_postfix
        golden = golden_base + proto_name
        files += move(output, golden)
    return files


def main(argv):
    del argv

    build_protos([_TARGET % "immutablejs", _TARGET % "j2cl"])

    files = []
    files += update_goldens(kind="immutablejs", output_postfix="-improto")
    files += update_goldens(
        kind="j2cl", output_postfix="_j2cl_proto_for_testing_do_not_use")

    g4("add", files)
    g4("revert", ["-a"])


if __name__ == "__main__":
    app.run(main)