Perform random search over the hyperparameter space.

  Arguments:
    logdir: The top-level directory into which to write data. This
      directory should be empty or nonexistent.
    verbose: If true, print out each run's name as it begins.
482899
def run_all(logdir, verbose=False):
  
  data = prepare_data()
  rng = random.Random(0)

  base_writer = tf.summary.create_file_writer(logdir)
  with base_writer.as_default():
    experiment = hp.Experiment(hparams=HPARAMS, metrics=METRICS)
    experiment_string = experiment.summary_pb().SerializeToString()
    tf.summary.experimental.write_raw_pb(experiment_string, step=0)
    base_writer.flush()
  base_writer.close()

  sessions_per_group = 2
  num_sessions = flags.FLAGS.num_session_groups * sessions_per_group
  session_index = 0  # across all session groups
  for group_index in xrange(flags.FLAGS.num_session_groups):
    hparams = {h: sample_uniform(h.domain, rng) for h in HPARAMS}
    hparams_string = str(hparams)
    group_id = hashlib.sha256(hparams_string.encode("utf-8")).hexdigest()
    for repeat_index in xrange(sessions_per_group):
      session_id = str(session_index)
      session_index += 1
      if verbose:
        print(
            "--- Running training session %d/%d"
            % (session_index, num_sessions)
        )
        print(hparams_string)
        print("--- repeat #: %d" % (repeat_index + 1))
      run(
          data=data,
          base_logdir=logdir,
          session_id=session_id,
          group_id=group_id,
          hparams=hparams,
      )
748518
def _initIndexDir(self):
        """"""
        if not os.path.exists(self.logdir):
            os.mkdir(self.logdir)
            dprint(1, "created", self.logdir)
        Purr.RenderIndex.initIndexDir(self.logdir)
36603
def auto_set_dir(action=None, name=None):
    
    mod = sys.modules['__main__']
    basename = os.path.basename(mod.__file__)
    auto_dirname = os.path.join('train_log', basename[:basename.rfind('.')])
    if name:
        auto_dirname += '_%s' % name if os.name == 'nt' else ':%s' % name
    set_logger_dir(auto_dirname, action=action)
390318
public Optional<String> getLogDir() {
        return brokerStarted ? Optional.of(kafkaLogDir.toString()) : Optional.empty();
    }
11630
function createLogger(opt_level, opt_dir) {
  var config = getLogConfig(opt_level, opt_dir);
  var transports = getTransports(config);

  // check logdir
  if (!fs.existsSync(config.file.dir)) {
    throw new Error(
      util.format('The logdir does not exist: %s', config.file.dir));
  }

  // create instance
  var logger = new (winston.Logger)({
    transports: [
      new winston.transports.Console(transports.console),
      new winston.transports.File(transports.file)
    ],
    exitOnError: false,
    exceptionHandlers: [
      new winston.transports.File(transports.error)
    ]
  });

  // use syslog's levels
  logger.setLevels(winston.config.syslog.levels);

  // if production env, remove console logger
  if (process.env.NODE_ENV === 'production') {
    logger.remove(winston.transports.Console);
  }

  return logger;
}
1007097
function writeLogs(test, dirName) {
  var logs =
    test.fullTitle() +
    '\n' +
    test.file +
    '\nStart: ' +
    test.start +
    '\nEnd: ' +
    test.end +
    '\nElapsed: ' +
    test.duration +
    '\nStatus: ' +
    test.state;
  if (test.state === 'fail') {
    logs += '\nError: ' + test.err.stack;
  }
  mkdirp.sync(testDir(test, dirName));
  fs.writeFileSync(testURL(test, dirName), logs);
  test.url = testURL(test, dirName);
}
302464
def runRmdir(self, dir, timeout=None, **kwargs):
        
        cmd_args = {'dir': dir, 'logEnviron': self.logEnviron}
        if timeout:
            cmd_args['timeout'] = timeout
        return self.runRemoteCommand('rmdir', cmd_args, **kwargs)
1348909
public String logDirectory()
    {
        if (tc.isEntryEnabled())
            Tr.entry(tc, "logDirectory", this);
        if (tc.isEntryEnabled())
            Tr.exit(tc, "logDirectory", _logDirectory);
        return _logDirectory;
    }
997272
def run_all(logdir, verbose=False):
  
  waves = [sine_wave, square_wave, triangle_wave,
           bisine_wave, bisine_wahwah_wave]
  for (i, wave_constructor) in enumerate(waves):
    wave_name = wave_constructor.__name__
    run_name = 'wave:%02d,%s' % (i + 1, wave_name)
    if verbose:
      print('--- Running: %s' % run_name)
    run(logdir, run_name, wave_name, wave_constructor)
1123525
def _init_logging(anteater_log):
    

    LOG.setLevel(logging.DEBUG)
    ch = logging.StreamHandler()
    formatter = logging.Formatter('%(asctime)s - %(name)s - '
                                  '%(levelname)s - %(message)s')
    ch.setFormatter(formatter)
    ch.setLevel(logging.DEBUG)

    # create the directory if it does not exist
    path = os.path.dirname(anteater_log)
    try:
        os.makedirs(path)
    except OSError as e:
        if e.errno != errno.EEXIST:
            raise

    handler = logging.FileHandler(anteater_log)
    handler.setFormatter(formatter)
    handler.setLevel(logging.DEBUG)
    del logging.root.handlers[:]
    logging.root.addHandler(ch)
    logging.root.addHandler(handler)
272312
public static void zipDirectory(Logger log, File directory, ZipOutputStream zos, String path, FileFilter filter) throws IOException {
        // get a listing of the directory content
        File[] dirList = directory.listFiles();
        byte[] readBuffer = new byte[8192];
        int bytesIn = 0;
        // loop through dirList, and zip the files
        if (dirList != null) {
            for (File f : dirList) {
                if (f.isDirectory()) {
                    String prefix = path + f.getName() + "/";
                    if (matches(filter, f)) {
                        zos.putNextEntry(new ZipEntry(prefix));
                        zipDirectory(log, f, zos, prefix, filter);
                    }
                } else {
                    String entry = path + f.getName();
                    if (matches(filter, f)) {
                        FileInputStream fis = new FileInputStream(f);
                        try {
                            ZipEntry anEntry = new ZipEntry(entry);
                            zos.putNextEntry(anEntry);
                            bytesIn = fis.read(readBuffer);
                            while (bytesIn != -1) {
                                zos.write(readBuffer, 0, bytesIn);
                                bytesIn = fis.read(readBuffer);
                            }
                        } finally {
                            fis.close();
                        }
                        if (log.isDebugEnabled()) {
                            log.debug("zipping file " + entry);
                        }
                    }
                }
                zos.closeEntry();
            }
        }
    }
303061
def log_to_file(logdir, mode='a', delete=False, clearmem=True):
    
    logger = FileLogger(logdir, mode, delete, clearmem)
    _loggers.append(logger)
    return log_to(logger)
1160613
private File getLogsDirectory() {
        if (logsDirectory != null) {
            return logsDirectory;
        }
        logsDirectory = new File(SeLionGridConstants.LOGS_DIR);

        if (!logsDirectory.exists()) {
            logsDirectory.mkdirs();
        }

        return logsDirectory;
    }
898227
def log(self, n=None, **kwargs):
        
        cmd = ['hg', 'log']
        if n:
            cmd.extend('-l%d' % n)
        cmd.extend(
            (('--%s=%s' % (k, v)) for (k, v)
                in iteritems(kwargs))
        )
        return self.sh(cmd, shell=False)
1195857
def init_logging(logfile=DEFAULT_LOGNAME, default=None, level=logging.INFO):
    

    if logfile == "INDEF":
        if not is_blank(default):
            logname = fileutil.buildNewRootname(default, '.log')
        else:
            logname = DEFAULT_LOGNAME
    elif logfile not in [None, "" , " "]:
        if logfile.endswith('.log'):
            logname = logfile
        else:
            logname = logfile + '.log'
    else:
        logname = None

    if logname is not None:
        logutil.setup_global_logging()
        # Don't use logging.basicConfig since it can only be called once in a
        # session
        # TODO: Would be fine to use logging.config.dictConfig, but it's not
        # available in Python 2.5
        global _log_file_handler
        root_logger = logging.getLogger()
        if _log_file_handler:
            root_logger.removeHandler(_log_file_handler)
        # Default mode is 'a' which is fine
        _log_file_handler = logging.FileHandler(logname)
        # TODO: Make the default level configurable in the task parameters
        _log_file_handler.setLevel(level)
        _log_file_handler.setFormatter(
            logging.Formatter('[%(levelname)-8s] %(message)s'))
        root_logger.setLevel(level)
        root_logger.addHandler(_log_file_handler)

        print('Setting up logfile : ', logname)

        #stdout_logger = logging.getLogger('stsci.tools.logutil.stdout')
        # Disable display of prints to stdout from all packages except
        # drizzlepac
        #stdout_logger.addFilter(logutil.EchoFilter(include=['drizzlepac']))
    else:
        print('No trailer file created...')
545228
def setup_logger(log_dir=None, loglevel=logging.DEBUG):
    

    create_home_dir()
    create_dir(os.path.join(get_default_home_dir(), 'log'))

    if log_dir is None:
        log_dir = os.path.join(get_default_home_dir(), 'log')

    logger = logging.getLogger('ding0') # use filename as name in log
    logger.setLevel(loglevel)

    # create a file handler
    handler = logging.FileHandler(os.path.join(log_dir, 'ding0.log'))
    handler.setLevel(logging.DEBUG)
    formatter = logging.Formatter(
        '%(asctime)s-%(funcName)s-%(message)s (%(levelname)s)')
    handler.setFormatter(formatter)

    # create a stream handler (print to prompt)
    stream = logging.StreamHandler()
    stream.setLevel(logging.INFO)
    stream_formatter = logging.Formatter(
        '%(message)s (%(levelname)s)')
    stream.setFormatter(stream_formatter)

    # add the handlers to the logger
    logger.addHandler(handler)
    logger.addHandler(stream)

    logger.info('########## New run of Ding0 issued #############')

    return logger
1226226
def _suppress_distutils_logs():
    
    f = distutils.log.Log._log

    def _log(log, level, msg, args):
        if level >= distutils.log.ERROR:
            f(log, level, msg, args)

    distutils.log.Log._log = _log
    yield
    distutils.log.Log._log = f