Skip to content
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

Job output transform #548

Open
wants to merge 53 commits into
base: master
Choose a base branch
from
Open

Job output transform #548

wants to merge 53 commits into from

Conversation

OlivGruwe
Copy link

@OlivGruwe OlivGruwe commented Aug 8, 2023

  • Add support for various GeoTIFF formats, allowing flexible handling and representation of GeoTIFFs in outputs
    (fixes #100 <https://github.com/crim-ca/weaver/issues/100>_).
  • Add support for GET /results/{id} and GET /outputs/{id} routes to enable direct access to individual
    job result items by ID. This enhancement includes: support alternate representations based on the Accept header.
    If an alternate format (e.g., YAML for a JSON source) is requested it will be automatically generated and returned.
    Link headers containing all possible output formats, allowing retrieval via query parameters
    (e.g., output?f=application/x-yaml). (fixes #18 <https://github.com/crim-ca/weaver/issues/18>_).

OlivGruwe added 8 commits June 7, 2023 10:47
Direct Links in job output +
makefile +
tests
Testing transformer engine added
Remove requirements-trfm
Add to main requirements
Update requirements
Ajout Multi frame Images
@github-actions github-actions bot added ci/doc Issue related to documentation of the package ci/operations Related to CI operations (actions, execution, install, builds, etc.) ci/tests Tests of the package and features feature/oas Issues related to OpenAPI specifications. process/wps3 Issue related to WPS 3.x (REST-JSON) processes support labels Aug 9, 2023
Copy link
Collaborator

@fmigneault fmigneault left a comment

Choose a reason for hiding this comment

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

There's a few linting issues that can be resolved automatically using the make fix[...] targets.
Validate as well using make check[...] targets any other flagged issues that might need some manual adjustments. I didn't comment on all of them.

I did not go in depth into the actual implementation of the transform functions.
I think there is a few tests missing to validate that the actual results from each transformation is valid (eg: pixel values from one format to another are properly rendered or expected text from one format to another is properly structured).

Makefile Outdated Show resolved Hide resolved
tests/smoke/docker-compose.smoke-test.yml Outdated Show resolved Hide resolved
tests/wps_restapi/test_jobs.py Outdated Show resolved Hide resolved
tests/transform/test_tranform.py Outdated Show resolved Hide resolved
weaver/formats.py Outdated Show resolved Hide resolved
weaver/processes/builtin/__init__.py Outdated Show resolved Hide resolved
weaver/wps_restapi/jobs/jobs.py Outdated Show resolved Hide resolved
weaver/tranform/png2svg.py Outdated Show resolved Hide resolved
weaver/tranform/tiff.py Outdated Show resolved Hide resolved
weaver/tranform/transform.py Outdated Show resolved Hide resolved
@github-actions github-actions bot added feature/job Issues related to job execution, reporting and logging. feature/quotation Issues related to quotation, billing and estimators. process/builtin Issue related to builtin application processes labels Sep 24, 2024
@Nazim-crim Nazim-crim self-assigned this Sep 24, 2024
@github-actions github-actions bot added the feature/cli Issues or features related to CLI operations. label Sep 25, 2024
@github-actions github-actions bot added the feature/db Related to database or datatype manipulation. label Nov 5, 2024
@github-actions github-actions bot added the feature/providers Issue related to providers convertion to WPS-REST processes. label Nov 6, 2024
Copy link

codecov bot commented Nov 6, 2024

Codecov Report

Attention: Patch coverage is 85.98266% with 97 lines in your changes missing coverage. Please review.

Project coverage is 87.04%. Comparing base (0cebfa0) to head (c017929).
Report is 81 commits behind head on master.

Files with missing lines Patch % Lines
weaver/transform/transform.py 81.12% 40 Missing and 17 partials ⚠️
weaver/transform/tiff.py 47.82% 21 Missing and 3 partials ⚠️
weaver/transform/png2svg.py 95.86% 3 Missing and 2 partials ⚠️
weaver/transform/utils.py 92.00% 2 Missing and 2 partials ⚠️
weaver/wps_restapi/jobs/jobs.py 89.47% 2 Missing and 2 partials ⚠️
weaver/datatype.py 89.28% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #548      +/-   ##
==========================================
- Coverage   87.07%   87.04%   -0.04%     
==========================================
  Files          80       84       +4     
  Lines       20472    21134     +662     
  Branches     2784     2898     +114     
==========================================
+ Hits        17827    18397     +570     
- Misses       1902     1970      +68     
- Partials      743      767      +24     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -12,6 +12,13 @@ Changes

Changes:
--------
- Add support for various GeoTIFF formats, allowing flexible handling and representation of GeoTIFFs in outputs
(fixes `#100 <https://github.com/crim-ca/weaver/issues/100>`_).
- Add support for ``GET /results/{id}`` and `` GET /outputs/{id}`` routes to enable direct access to individual
Copy link
Collaborator

Choose a reason for hiding this comment

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

Update paths to start with the /jobs/{jobId}/...

Remove the extra space between `` and GET causing bad parsing.

- Add support for various GeoTIFF formats, allowing flexible handling and representation of GeoTIFFs in outputs
(fixes `#100 <https://github.com/crim-ca/weaver/issues/100>`_).
- Add support for ``GET /results/{id}`` and `` GET /outputs/{id}`` routes to enable direct access to individual
job result items by ID. This enhancement includes: support alternate representations based on the Accept header.
Copy link
Collaborator

Choose a reason for hiding this comment

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

  • remove :
  • add `` to Accept

Comment on lines +20 to +21
Link headers containing all possible output formats, allowing retrieval via query parameters
(e.g., output?f=application/x-yaml). (fixes `#18 <https://github.com/crim-ca/weaver/issues/18>`_).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Make this a separate item, and apply Link formatting, e.g.:

"- Return Link headers all possible alternate output formats, ..."

Apply the formatting to the example, and use the full /jobs/{jobId}/... link.

requirements-dev.txt Show resolved Hide resolved
requirements.txt Show resolved Hide resolved
Comment on lines +637 to +642
# Get requested media-type. "*/*" if omit
accept = str(request.accept) if request.accept else "*/*"
headers = request.headers
possible_media_types = get_job_possible_output_formats(job)
possible_media_types = next((o["alternatives"] for o in possible_media_types
if str(o["output_id"]) == output_id), None)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do the media-type lookup after validating that the result ID is actually available (code just below).
Otherwise, these are unnecessary operations.

Also, this seems over-complicated with the function.
It creates an alternate dict of metadata, just to not use all the keys and return only the media-types.
It would be easier to simply do the loop here and set the variable with the matched combination of output-id and accept media-type that apply for the specific output transforms.

Comment on lines +649 to +653
"code": "",
"description": "The requested output format is not in the possible output formats.",
"cause": "Incompatible mime Types",
"error": "",
"value": ""
Copy link
Collaborator

Choose a reason for hiding this comment

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

Improve the details. This is misleading. The error is related to output ID not available, not the format.

"value": ""
}
)
result_media_type = result["mimeType"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

use get_field to handle case where mediaType name would used instead

result_media_type = guess_target_format(request, default=result_media_type)

# if format requested not equal to result media type and not in possible mediatypes...
if accept != result_media_type and accept not in possible_media_types:
Copy link
Collaborator

Choose a reason for hiding this comment

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

no need to cross-validate accept, this is what guess_target_format does (+ format queries)
directly do if result_media_type not in possible_media_types

weaver/wps_restapi/swagger_definitions.py Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci/doc Issue related to documentation of the package ci/operations Related to CI operations (actions, execution, install, builds, etc.) ci/tests Tests of the package and features feature/cli Issues or features related to CLI operations. feature/db Related to database or datatype manipulation. feature/job Issues related to job execution, reporting and logging. feature/oas Issues related to OpenAPI specifications. feature/providers Issue related to providers convertion to WPS-REST processes. feature/quotation Issues related to quotation, billing and estimators. process/builtin Issue related to builtin application processes process/wps3 Issue related to WPS 3.x (REST-JSON) processes support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants