-
Notifications
You must be signed in to change notification settings - Fork 32
Propagate data export endpoints to webserver #7244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
bisgaard-itis
merged 72 commits into
ITISFoundation:master
from
bisgaard-itis:7197-add-zipping-endpoints-in-storage
Feb 21, 2025
Merged
Changes from 66 commits
Commits
Show all changes
72 commits
Select commit
Hold shift + click to select a range
156a19a
factor out tasks part in storage rpc api
bisgaard-itis 64c137d
use 'async_jobs' terminology and refactor rpc client for reusability
bisgaard-itis f6e73e3
further refactoring
bisgaard-itis 50fa599
make async job rpc client more reusable
bisgaard-itis 1ce7158
tasks -> async jobs
bisgaard-itis 1229e92
tasks -> async_job
bisgaard-itis ce064ce
start adding data-export endpoints in webserver
bisgaard-itis 223631e
further renaming
bisgaard-itis 0bd94d6
create openapi-specs make target for webserver to ensure github workf…
bisgaard-itis b43b22d
add webserver endpoint for triggering data export
bisgaard-itis 9795838
add webserver endpoint for getting async job status
bisgaard-itis 224dfe2
minor fix
bisgaard-itis 3fb022e
add initial test
bisgaard-itis ac06db4
pass login and permission in test
bisgaard-itis 249967e
add get status test
bisgaard-itis 8b154af
add location id in webserver endpoint
bisgaard-itis ac20937
task_id -> job_id
bisgaard-itis 527e7a6
cleanup
bisgaard-itis 999907e
add test for abort endpoint
bisgaard-itis 520c043
add test for endpoint of getting result
bisgaard-itis 1b42a8f
update webserver openapi specs
bisgaard-itis a649c71
start adding exceptions and propagating them
bisgaard-itis 4ad6aac
add exception handling to endpoint for triggering data export
bisgaard-itis 33b5ccf
remove 'data_export' from async jobs model lib section
bisgaard-itis 661b3b2
add exception handling for remaining endpoints
bisgaard-itis 6972cf5
merge master into 7197-add-zipping-endpoints-in-storage
bisgaard-itis e19eea7
update openapi specs of webserver
bisgaard-itis 311ba29
add user id to data export endpoint
bisgaard-itis d614e7e
fix typecheck
bisgaard-itis db55e79
fix openapi spec test
bisgaard-itis 8bd254d
merge master into 7197-add-zipping-endpoints-in-storage
bisgaard-itis 1718df8
@sanderegg fix absolute imports
bisgaard-itis 7faf55f
@sanderegg @pcrespov remove 'rpc' from classnames
bisgaard-itis 434602f
task_progress -> progress
bisgaard-itis fd777ab
rename storage schemas exposed via webserver
bisgaard-itis 400a6c1
use ProgressReport
bisgaard-itis 3383265
restructuring
bisgaard-itis b0f8a7f
services/webserver api version: 0.58.0 → 0.59.0
bisgaard-itis 8acc41c
storage/_handlers.py -> storage/_rest.py
bisgaard-itis df04839
merge master into 7197-add-zipping-endpoints-in-storage
bisgaard-itis c3758bd
update opena api specs
bisgaard-itis ccff359
@pcrespov streamline to_rpc_schema methods
bisgaard-itis 09a3650
merge master into 7197-add-zipping-endpoints-in-storage
bisgaard-itis b01e479
add rpc method for getting jobs associated with user
bisgaard-itis eec16d8
add webserver rest endpoint for getting user jobs
bisgaard-itis 432dbb3
add test of rest endpoint for getting jobs associated with user
bisgaard-itis 8e6162d
minor cleanup
bisgaard-itis 4dfe2d0
merge master into 7197-add-zipping-endpoints-in-storage
bisgaard-itis f817a52
move thing around
bisgaard-itis 6a19215
make pylint happy
bisgaard-itis 8356158
update openapi specs
bisgaard-itis da0f6ea
fix webserver mocks
bisgaard-itis 63bc45c
cleanup
bisgaard-itis 8821e57
merge master into 7197-add-zipping-endpoints-in-storage
bisgaard-itis e5ff440
make pylint happy
bisgaard-itis f0848a4
export get async jobs method in webserver openapi specs
bisgaard-itis 98da41b
Update api/specs/web-server/_storage.py
bisgaard-itis 83a8941
Update api/specs/web-server/_storage.py
bisgaard-itis bc49fb0
Update api/specs/web-server/_storage.py
bisgaard-itis e1488a8
Update api/specs/web-server/_storage.py
bisgaard-itis 247d64f
Update api/specs/web-server/_storage.py
bisgaard-itis 61d0683
use AsyncJobId consistently @GitHK
bisgaard-itis 6132f82
update openapi specs
bisgaard-itis e50c1aa
make list jobs endpoint generic
bisgaard-itis 57e2576
propagate changes to webserver
bisgaard-itis 25265cb
make pylint happy
bisgaard-itis dd3fdf9
make submit job endpoint generic @GitHK
bisgaard-itis fe8f33e
factor out RequestContext and forward product name to storage @matusd…
bisgaard-itis 666ed11
merge master into 7197-add-zipping-endpoints-in-storage
bisgaard-itis 38030ab
fix test in storage
bisgaard-itis 2be7088
merge master into 7197-add-zipping-endpoints-in-storage
bisgaard-itis 63ccfa2
Merge branch 'master' into 7197-add-zipping-endpoints-in-storage
bisgaard-itis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
packages/models-library/src/models_library/api_schemas_rpc_async_jobs/exceptions.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| from common_library.errors_classes import OsparcErrorMixin | ||
|
|
||
|
|
||
| class BaseAsyncjobRpcError(OsparcErrorMixin, RuntimeError): | ||
| pass | ||
|
|
||
|
|
||
| class StatusError(BaseAsyncjobRpcError): | ||
| msg_template: str = "Could not get status of job {job_id}" | ||
|
|
||
|
|
||
| class ResultError(BaseAsyncjobRpcError): | ||
| msg_template: str = "Could not get results of job {job_id}" |
32 changes: 32 additions & 0 deletions
32
packages/models-library/src/models_library/api_schemas_storage/data_export_async_jobs.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # pylint: disable=R6301 | ||
| from pathlib import Path | ||
|
|
||
| from common_library.errors_classes import OsparcErrorMixin | ||
| from models_library.projects_nodes_io import LocationID | ||
| from models_library.users import UserID | ||
| from pydantic import BaseModel, Field | ||
|
|
||
|
|
||
| class DataExportTaskStartInput(BaseModel): | ||
| user_id: UserID | ||
| location_id: LocationID | ||
| paths: list[Path] = Field(..., min_length=1) | ||
|
|
||
|
|
||
| ### Exceptions | ||
|
|
||
|
|
||
| class StorageRpcError(OsparcErrorMixin, RuntimeError): | ||
| pass | ||
|
|
||
|
|
||
| class InvalidFileIdentifierError(StorageRpcError): | ||
| msg_template: str = "Could not find the file {file_id}" | ||
|
|
||
|
|
||
| class AccessRightError(StorageRpcError): | ||
| msg_template: str = "User {user_id} does not have access to file {file_id}" | ||
|
|
||
|
|
||
| class DataExportError(StorageRpcError): | ||
| msg_template: str = "Could not complete data export job with id {job_id}" |
14 changes: 0 additions & 14 deletions
14
packages/models-library/src/models_library/api_schemas_storage/data_export_tasks.py
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
packages/models-library/src/models_library/api_schemas_webserver/storage.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| from datetime import datetime | ||
| from pathlib import Path | ||
| from typing import Any | ||
|
|
||
| from ..api_schemas_rpc_async_jobs.async_jobs import ( | ||
| AsyncJobGet, | ||
| AsyncJobId, | ||
| AsyncJobResult, | ||
| AsyncJobStatus, | ||
| ) | ||
| from ..api_schemas_storage.data_export_async_jobs import DataExportTaskStartInput | ||
| from ..progress_bar import ProgressReport | ||
| from ..projects_nodes_io import LocationID | ||
| from ..users import UserID | ||
| from ._base import InputSchema, OutputSchema | ||
|
|
||
|
|
||
| class DataExportPost(InputSchema): | ||
| paths: list[Path] | ||
|
|
||
| def to_rpc_schema( | ||
| self, user_id: UserID, location_id: LocationID | ||
| ) -> DataExportTaskStartInput: | ||
| return DataExportTaskStartInput( | ||
| paths=self.paths, user_id=user_id, location_id=location_id | ||
| ) | ||
|
|
||
|
|
||
| class StorageAsyncJobGet(OutputSchema): | ||
| job_id: AsyncJobId | ||
|
|
||
| @classmethod | ||
| def from_rpc_schema(cls, async_job_rpc_get: AsyncJobGet) -> "StorageAsyncJobGet": | ||
| return StorageAsyncJobGet(job_id=async_job_rpc_get.job_id) | ||
|
|
||
|
|
||
| class StorageAsyncJobStatus(OutputSchema): | ||
| job_id: AsyncJobId | ||
| progress: ProgressReport | ||
| done: bool | ||
| started: datetime | ||
| stopped: datetime | None | ||
|
|
||
| @classmethod | ||
| def from_rpc_schema( | ||
| cls, async_job_rpc_status: AsyncJobStatus | ||
| ) -> "StorageAsyncJobStatus": | ||
| return StorageAsyncJobStatus( | ||
| job_id=async_job_rpc_status.job_id, | ||
| progress=async_job_rpc_status.progress, | ||
| done=async_job_rpc_status.done, | ||
| started=async_job_rpc_status.started, | ||
| stopped=async_job_rpc_status.stopped, | ||
| ) | ||
|
|
||
|
|
||
| class StorageAsyncJobResult(OutputSchema): | ||
| result: Any | None | ||
| error: Any | None | ||
|
|
||
| @classmethod | ||
| def from_rpc_schema( | ||
| cls, async_job_rpc_result: AsyncJobResult | ||
| ) -> "StorageAsyncJobResult": | ||
| return StorageAsyncJobResult( | ||
| result=async_job_rpc_result.result, error=async_job_rpc_result.error | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.