yasithdev opened a new pull request, #186:
URL: https://github.com/apache/airavata-portals/pull/186

   ## Summary
   
   Migrates the Django portal's **data-product READ path** from the legacy 
Thrift API to the gRPC `research`/`storage` facades. The legacy 
`airavata_django_portal_sdk.user_storage` functions internally call Thrift 
`getDataProduct`, which read-times-out against the gone Thrift server and 
**hung** every data-product request (`/api/data-products/`, `FullExperiment`) 
for ~20s. This removes that hang.
   
   Continues the established Track D read-migration pattern: views call 
`request.airavata.<facade>.<method>()` and `grpc_adapters` adapts the protobuf 
to the Thrift attribute names the existing serializers read, so the REST/JSON 
contract is unchanged and the frontend is untouched.
   
   ## Changes
   
   - **All 11 Thrift `getDataProduct` calls → `research.get_data_product(uri)` 
+ `grpc_adapters.data_product(...)`**: `FullExperimentViewSet.get_instance` 
(inputs/outputs incl. `URI_COLLECTION`), `DataProductView.get`/`.put`, 
`delete_file`, `output_views._generate_data`, `workspace.create_experiment`.
   - **`DataProductSerializer` method-fields reworked off `user_storage`** — 
all derived without a backend call:
     - `filesize` ← `productSize` (data-product registry).
     - `isInputFileUpload` ← first replica `filePath` parent dir basename == 
`"tmp"` (`TMP_INPUT_FILE_UPLOAD_DIR`); null-safe.
     - `downloadURL` ← lazy portal URL to the new `download-file` endpoint; 
`None` when no replica.
     - `userHasWriteAccess` ← owner match → True; else shared-path → 
`is_gateway_admin`; else True. Null-safe.
   - **New byte-streaming download endpoint** (`download-file`, wired in 
`urls.py`): resolves the data product, streams the first replica via 
`storage.download_file` as a `FileResponse`. Replaces 
`user_storage.get_lazy_download_url`/`get_download_url`.
   - `output_views`/`delete_file`/`create_experiment` use the `storage` facade 
(`file_exists`/`download_file`/`delete_file`) on the first replica path.
   - `view_utils.DataProductSharedDirPermission` resolves the path via 
`research.get_data_product` instead of `user_storage.get_data_product_metadata`.
   - New `grpc_adapters.data_product_file_path` helper: first replica 
`filePath`, `~/`-prefixed when relative (the storage facade NPEs on a bare 
relative path).
   
   Upload/write/list views (`upload_input_file`, `tus_upload_finish`, 
`UserStoragePathView`, `ExperimentStoragePathView`, etc.) are intentionally 
left on `user_storage` for later increments (D4.2/D4.3).
   
   ## Test plan
   
   - `manage.py check` green.
   - Existing `apps/api` view tests: no new regressions (the 6 unrelated 
Groups/IAM failures pre-exist on the base branch — verified by stashing this 
diff and re-running).
   - **Live against the tilt backend (:9090)**:
     - `GET /api/data-products/?product-uri=<uri>` via Bearer token → returns 
in **0.06s** (was a ~20s Thrift hang), proving the path is gRPC.
     - New `GET /api/download-file?data-product-uri=<uri>` route reaches the 
view in **0.011s**.
     - Storage file plane round-trips live: upload lands real bytes; 
`file_exists`/`get_file_metadata`/`download_file` work.
     - **Download view end-to-end** (live storage facade): HTTP 200, 
`Content-Disposition: inline; filename=...`, streamed bytes byte-for-byte match 
the uploaded file.
     - Adapter + serializer rendered against a realistic protobuf 
`DataProductModel` (the dev backend rejects ad-hoc `register_data_product` — 
needs a pre-seeded parent Collection — so registered-data-product rendering is 
offline-validated like other dev-data-limited Track D families): all four 
method-fields + enum name-bridges 
(`DataProductType`/`ReplicaLocationCategory`/`ReplicaPersistentType` 
proto→Thrift by name) correct, full null-safety.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to