Exemplo n.º 1
0
 def _querystring(self, searchinfo):
     fields = searchinfo['fields']
     operator = searchinfo['operator'].upper()
     if operator not in ('AND', 'OR', 'ANDNOT', 'ANDMAYBE', 'NOT'):
         raise ValueError("Unknown operator '%s'." % operator)
     if set(fields.keys()).difference(['name', 'summary']):
         raise ValueError("Only 'name' and 'summary' allowed in query.")
     parts = []
     for key, field in (('name', 'project'), ('summary', 'summary')):
         value = fields.get(key, [])
         if len(value) == 0:
             continue
         elif len(value) == 1:
             parts.append('(type:%s "%s")' % (field, value[0].replace('"', '')))
         else:
             raise ValueError("Only one value allowed for query.")
     querystring = (" %s " % operator).join(parts)
     log.debug("_querystring {0}".format(querystring))
     return querystring
Exemplo n.º 2
0
 def _maybe_scalars(self, fields, run):
     from tensorboard.backend.event_processing import event_multiplexer
     from tensorboard.backend.event_processing import event_accumulator
     _ensure_tf_logger_patched()
     scalars = {}
     for path in event_multiplexer.GetLogdirSubdirectories(run.path):
         events_checksum_field_name = self._events_checksum_field_name(path)
         last_checksum = fields.get(events_checksum_field_name)
         cur_checksum = self._events_checksum(path)
         log.debug("event path checksums for %s: last=%s, cur=%s", path,
                   last_checksum, cur_checksum)
         if last_checksum == cur_checksum:
             continue
         scalars[events_checksum_field_name] = cur_checksum
         log.debug("indexing events in %s", path)
         rel_path = os.path.relpath(path, run.path)
         events = event_accumulator._GeneratorFromPath(path).Load()
         scalar_vals = self._scalar_vals(events, rel_path)
         for key, vals in scalar_vals.items():
             if not vals:
                 continue
             self._store_scalar_vals(key, vals, scalars)
     return scalars
Exemplo n.º 3
0
 def _maybe_scalars(self, fields, run):
     from tensorboard.backend.event_processing import io_wrapper
     from tensorboard.backend.event_processing import event_accumulator
     from guild import tfevent
     tfevent.ensure_tf_logging_patched()
     scalars = {}
     scalar_aliases = self._init_scalar_aliases(run)
     for path in io_wrapper.GetLogdirSubdirectories(run.path):
         if not self._path_in_run(path, run):
             log.debug("%s is not part of run %s, skipping", path, run.id)
             continue
         events_checksum_field_name = self._events_checksum_field_name(path)
         last_checksum = fields.get(events_checksum_field_name)
         cur_checksum = self._events_checksum(path)
         log.debug("event path checksums for %s: last=%s, cur=%s", path,
                   last_checksum, cur_checksum)
         if last_checksum != cur_checksum:
             log.debug("indexing events in %s", path)
             rel_path = os.path.relpath(path, run.path)
             events = event_accumulator._GeneratorFromPath(path).Load()
             scalar_vals = self._scalar_vals(events, rel_path)
             self._apply_scalar_vals(scalar_vals, scalars, scalar_aliases)
             scalars[events_checksum_field_name] = cur_checksum
     return scalars
Exemplo n.º 4
0
 def _maybe_label_field(fields, run):
     label = _u(run.get("label", ""))
     return {"label": label} if label != fields.get("label") else {}
Exemplo n.º 5
0
 def _maybe_status_field(fields, run):
     status = _u(run.status)
     return {"status": status} if status != fields.get("status") else {}