Skip to content

Adding Airavata Storage type to store temp data for job input files - #797

Open
DImuthuUpe wants to merge 6 commits into
masterfrom
airavata-storage
Open

DImuthuUpe wants to merge 6 commits into
masterfrom
airavata-storage

Conversation

@DImuthuUpe

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved authorization and filesystem safety flaws permit unauthorized file access and overwrites, transfer corruption, and symlink-based writes outside the intended storage root.

8 open issues
What changed in this PR

Adds per-user Airavata-hosted storage so users can upload job inputs without registering an external storage host. The feature connects storage management, file transfers, job staging, and the dashboard.

Changes:

  • Adds Airavata storage APIs, persistence, configuration, documentation, and tests.
  • Adds dashboard file uploads and local staging support, with storage-specific transport adapters.
  • Relocates Linkspan components into an extension package and removes their batch-submission wiring.
File Description
internal/​transport/​transport.go Defines the generic transport interface.
internal/​transport/​scp.go Implements SCP storage transfers.
internal/​transport/​hpc.go Implements cluster storage transfers.
internal/​transport/​erase.go Adapts typed transports for shared registration.
internal/​transport/​airavata.go Implements local storage file operations.
internal/​server/​transfer_test.go Updates transfer tests for typed transports.
internal/​server/​server.go Registers Airavata storage and relocated Linkspan routes.
internal/​server/​server_test.go Configures temporary storage for tests.
internal/​server/​link_test.go Removes Linkspan integration tests.
internal/​server/​airavata_storage_test.go Tests storage creation, uploads, and access controls.
internal/​orchestration/​tasks/​data/​data.go Adds local storage staging operations.
internal/​orchestration/​tasks/​batch/​slurm.go Removes Linkspan template context wiring.
internal/​orchestration/​tasks/​batch/​slurm_test.go Updates signatures and removes Linkspan script coverage.
internal/​orchestration/​tasks/​batch/​batch.go Removes submission-time Linkspan configuration delivery.
internal/​orchestration/​engine.go Wires local storage into staging tasks.
internal/​mcp/​client/​client.gen.go Adds generated Airavata storage client support.
internal/​db/​migrations/​0021_airavata_data_storage.sql Creates the per-user storage table.
internal/​db/​migrate.go Registers storage and relocated Linkspan models.
internal/​db/​migrate_test.go Checks creation of the storage table.
internal/​db/​foreignkey_test.go Checks the storage owner relationship.
internal/​config/​config.go Adds the local storage root setting.
internal/​common/​http.go Adds shared not-found error translation.
internal/​app/​app.go Assembles storage services, lookups, and transports.
INSTALL.md Documents the storage root configuration.
extensions/​linkspan/​service.go Houses Linkspan URL and authentication logic.
extensions/​linkspan/​repository.go Houses link-record persistence.
extensions/​linkspan/​registry.go Relocates the live connection registry.
extensions/​linkspan/​README.md Adds a manual Linkspan launch example.
extensions/​linkspan/​model.go Relocates the persistent link model.
extensions/​linkspan/​jupyter.go Houses Jupyter access and credential issuance.
extensions/​linkspan/​api.go Relocates Linkspan and Jupyter handlers.
docs/​openapi.yaml Defines storage endpoints, schema, and enum value.
docs/​data-product.md Documents local storage and upload usage.
dashboard/​src/​lib/​types.ts Adds Airavata storage types.
dashboard/​src/​lib/​airavataStorage.ts Adds storage provisioning and upload helpers.
dashboard/​src/​app/​processes/​view/​page.tsx Labels Airavata staging endpoints.
dashboard/​src/​app/​processes/​new/​page.tsx Adds file-input upload controls.
dashboard/​src/​app/​data/​page.tsx Labels Airavata-backed products.
api/​process/​service/​link.go Removes the former Linkspan service.
api/​process/​service/​launch.go Preserves output products’ storage types during staging.
api/​process/​repository/​link.go Removes the former link repository.
api/​process/​dto/​link.go Removes the former Jupyter response definition.
api/​data/​service/​transport.go Removes the former SCP transport implementation.
api/​data/​service/​transfer.go Selects transports and repositories by storage type.
api/​data/​service/​product.go Validates Airavata ownership and normalizes product paths.
api/​data/​service/​airavata_storage.go Manages per-user storage records and directories.
api/​data/​service/​airavata_storage_test.go Tests storage lifecycle and user-path handling.
api/​data/​repository/​storage.go Adds generic storage lookup adapters.
api/​data/​repository/​scp_storage.go Relocates SCP repository operations.
api/​data/​repository/​airavata_storage.go Adds Airavata storage persistence operations.
api/​data/​model/​storage.go Adds the storage model and path resolution.
api/​data/​model/​storage_test.go Tests path normalization and containment.
api/​data/​dto/​scp_storage.go Relocates SCP request and response definitions.
api/​data/​dto/​product.go Updates storage-type validation messaging.
api/​data/​dto/​airavata_storage.go Defines responses without host directory details.
api/​data/​controller/​scp_storage.go Relocates SCP storage handlers.
api/​data/​controller/​airavata_storage.go Adds caller-specific storage handlers.

Review effort: Balanced

case err == nil:
return true, nil
case errors.Is(err, os.ErrExist):
info, statErr := os.Stat(dir)
return fmt.Errorf("Failed to find data product %s: %v", *dataProductId, err)
}
destStorageID, destStorageType, destPath = dataProduct.DataStorageID, datamodel.DataStorageTypeSCP, dataProduct.Path
destStorageID, destStorageType, destPath = dataProduct.DataStorageID, dataProduct.DataStorageType, dataProduct.Path

// resolveAiravataPath turns a path on an Airavata storage into the file on this host.
func (a *Tasks) resolveAiravataPath(ctx context.Context, storageID, path string) (string, error) {
storage, err := a.airavataStorages.FindByID(ctx, storageID)
Comment on lines +43 to +51
dst, err := os.Create(fullPath)
if err != nil {
return fmt.Errorf("creating destination file %s: %w", fullPath, err)
}
defer dst.Close()

if _, err := io.Copy(dst, src); err != nil {
return fmt.Errorf("copying from %s to %s: %w", localPath, fullPath, err)
}
Comment on lines +341 to +343
if !storage.IsOwnedBy(principal.Name) {
return httpx.Forbidden("Access denied: Airavata data storage %s is not yours", storage.ID)
}

// A product on HPC storage — an output tracked in place — is reached through the
// cluster config the run submitted under, which its storage id names.
transport, ok := s.transports[product.DataStorageType]
<button
type="button"
className="small"
disabled={uploading !== null}
}

script, err := a.slurmScript(ctx, process, executionContext.GlobalJobConfigs, issued, envFilePath)
script, err := a.slurmScript(ctx, process, executionContext.GlobalJobConfigs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants