예제 #1
0
 def _read_blob(self, ctx, experiment, plugin_names, run, tag):
     for plugin_name in plugin_names:
         blob_sequences = self._data_provider.read_blob_sequences(
             ctx,
             experiment_id=experiment,
             plugin_name=plugin_name,
             run_tag_filter=provider.RunTagFilter(runs=[run], tags=[tag]),
             downsample=1,
         )
         blob_sequence_data = blob_sequences.get(run, {}).get(tag, ())
         try:
             blob_ref = blob_sequence_data[0].values[0]
         except IndexError:
             continue
         return self._data_provider.read_blob(ctx,
                                              blob_key=blob_ref.blob_key)
     raise errors.NotFound()
 def read_blob(self, ctx, *, blob_key):
     payload = base64.urlsafe_b64decode(blob_key)
     prefix = ("%s:" % self._name).encode("utf-8")
     if not payload.startswith(prefix):
         raise errors.NotFound("not %r.startswith(%r)" % (payload, prefix))
     return payload[len(prefix):]