mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-28 09:58:12 +08:00
re-implement re-embeddings (#1679)
* fix mispelling * re-implement re-embedding * always load base embedding to fetch counts * format * lint * fix tests * lint * fix accept handling * test log * more debug * more * more * more * more * remove logging * logging * jsonify * remove debugging logs * lint * clean up errors a bit * fix issue found in PR review * PR review changes
This commit is contained in:
+3
-15
@@ -304,10 +304,6 @@ def layout_obs_put(request, data_adaptor):
|
||||
if not data_adaptor.dataset_config.embeddings__enable_reembedding:
|
||||
return abort(HTTPStatus.NOT_IMPLEMENTED)
|
||||
|
||||
preferred_mimetype = request.accept_mimetypes.best_match(["application/octet-stream"])
|
||||
if preferred_mimetype != "application/octet-stream":
|
||||
return abort(HTTPStatus.NOT_ACCEPTABLE)
|
||||
|
||||
args = request.get_json()
|
||||
filter = args["filter"] if args else None
|
||||
if not filter:
|
||||
@@ -315,17 +311,9 @@ def layout_obs_put(request, data_adaptor):
|
||||
method = args["method"] if args else "umap"
|
||||
|
||||
try:
|
||||
schema, fbs = data_adaptor.compute_embedding(method, filter)
|
||||
return make_response(
|
||||
fbs,
|
||||
HTTPStatus.OK,
|
||||
{
|
||||
"Content-Type": "application/octet-stream",
|
||||
"CxG-Schema": json.dumps(schema),
|
||||
"Access-Control-Expose-Headers": "CxG-Schema",
|
||||
},
|
||||
)
|
||||
schema = data_adaptor.compute_embedding(method, filter)
|
||||
return make_response(jsonify(schema), HTTPStatus.OK, {"Content-Type": "application/json"})
|
||||
except NotImplementedError as e:
|
||||
return abort_and_log(HTTPStatus.NOT_IMPLEMENTED, str(e), include_exc_info=True)
|
||||
return abort_and_log(HTTPStatus.NOT_IMPLEMENTED, str(e))
|
||||
except (ValueError, DisabledFeatureError, FilterError) as e:
|
||||
return abort_and_log(HTTPStatus.BAD_REQUEST, str(e), include_exc_info=True)
|
||||
|
||||
Reference in New Issue
Block a user