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

   ## What
   
   Relocates API-side experiment behavior out of the Django portal SDK 
(`airavata_django_portal_sdk`) into the new gRPC SDK as a new 
framework-agnostic package, `airavata_sdk/helpers/`. No Django / DRF / 
`request` object / Thrift dependencies — every function takes an 
`AiravataClient` (`client`) plus explicit kwargs and routes all backend access 
through the gRPC facades (`client.research` / `client.storage` / 
`client.sharing`).
   
   ### `helpers/experiment_orchestration.py`
   - `launch(client, experiment_id, *, username)` — set input/output storage 
ids + per-experiment data dir, move tmp input-file uploads into the data dir, 
persist, then `launch_experiment(..., gateway_id=client.gateway_id)`.
   - `clone(client, experiment_id, *, username, project_id=None) -> str` — pick 
a writeable project, clone, copy input files into fresh tmp uploads, null the 
data dir, persist.
   - `is_input_file(data_product) -> bool` — derived purely from the 
`DataProductModel` proto (replica `file_path` parent dir == `tmp`); no backend 
call.
   - Intermediate-output helpers: `can_fetch_intermediate_output`, 
`get_intermediate_output_process_status`, `fetch_intermediate_output`, 
`get_intermediate_output_data_products` — read 
`experiment.processes[].tasks[].jobs[]` using proto field/enum names.
   
   Repointed from Thrift (`request.airavata_client.*`) + the Django 
`user_storage` module onto the gRPC facades and proto snake_case field names. 
Behavioral notes:
   - **Moving tmp input uploads is now done in place** (`storage.move_file` to 
relocate bytes + `research.update_replica_location` to repoint the replica 
`file_path`), preserving the data-product URI. The storage facade's 
`move_file`/`upload_file` return only a minimal `DataProductModel` (no URI, no 
replicas), so the replica catalog is updated explicitly.
   - **Clone input-file copy** is implemented as `download_file` -> 
`upload_file` to a fresh `tmp/` path -> `register_data_product` -> rewrite URI, 
since the storage facade has no copy primitive.
   
   ### `helpers/queue_settings.py`
   The queue-settings calculator registry + `queue_settings_calculator` 
decorator, relocated verbatim in behavior (a pure in-process registry). 
`calculate_queue_settings(calculator_id, *args, **kwargs)` forwards args/kwargs 
straight through, so an existing portal caller can keep calling 
`calculate_queue_settings(id, request, experiment_model)` unchanged. Public 
API: the decorator, `calculate_queue_settings`, `get_all`, `exists`, 
`reset_registry`, and the `QueueSettingsCalculator` namedtuple.
   
   ## Packaging
   setuptools auto-discovers `airavata_sdk.helpers` via the existing 
`airavata_sdk*` glob in `pyproject.toml` — no change needed. No version bump.
   
   ## Validation
   - `python -m py_compile airavata_sdk/helpers/*.py` — passes.
   - Editable install (`pip install -e .`, Python 3.13) + `import 
airavata_sdk.helpers.experiment_orchestration, 
airavata_sdk.helpers.queue_settings` — resolves, including the generated proto 
enums/models referenced.
   - Exercised the queue-settings registry end to end 
(register/lookup/calculate/passthrough/LookupError).
   - All facade methods and proto field/enum names grep-confirmed against 
`airavata_sdk/facade/*` and the generated stubs.
   - No live launch/clone against a backend (deferred to the portal-integration 
step).
   
   ## Facade / proto gaps (left as TODOs)
   - `research.get_intermediate_output_process_status(experiment_id)` takes 
only the experiment id; the old Thrift call filtered by output name. 
`output_names` is accepted for signature compatibility but not forwarded. 
Per-output status would need an `output_names` field on 
`GetIntermediateOutputProcessStatusRequest`.
   - The storage facade's `create_dir` has no `create_unique` option, so the 
old `create_user_dir(create_unique=True)` collision-suffixing is not reproduced 
— two experiments with the same project+name would share a data dir.
   - `storage.move_file` / `upload_file` return a minimal `DataProductModel` 
(no URI/replicas); replica-catalog updates are done explicitly here. The 
in-place `update_replica_location` round-trip (bare path as `file_path`) should 
be verified against a live backend during portal integration.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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