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 77 commits into
base: master
Choose a base branch
from
Open

Job output transform #548

wants to merge 77 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).

@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
@fmigneault fmigneault added the WIP Work in progress label Dec 14, 2024
@Nazim-crim Nazim-crim requested a review from fmigneault April 1, 2025 21:11
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.

rescanned quickly the changes, many comments are still open

Comment on lines +302 to +303
echo "Binary package manager cairo not found. Attempting to install it."; \
$(SUDO) apt-get install libpangocairo-1.0-0 \
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might need other libraries here. https://cairosvg.org/documentation/

@@ -23,6 +23,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
g++ \
git \
nodejs \
libpangocairo-1.0-0 \
Copy link
Collaborator

Choose a reason for hiding this comment

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

We will need to validate against libraries listed in https://cairosvg.org/documentation/ that are different...
Maybe a custom docker smoke-test or something? Not sure yet.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Since we already have a install-transforms Makefile target, I think we should consider moving the new dependencies to a dedicated requirements-transform.txt file to keep things clear.
The corresponding pip install -r requirements-transform.txt would be added to install-transforms.

Maybe another PR could explore the optional activation of transform capabilities...

Comment on lines +648 to +652
"code": "",
"description": "The requested output Id is not available in the job results.",
"cause": "The output ID is not available",
"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.

Fill the details (output_id in value, InvalidIdentifierValue for code).

Cause could indicate something more useful, such as The output ID must be one of: {} with the list retrieved from available IDs in job.results.

Use "ID" to be consistent across messages.

Comment on lines +667 to +677
is_reference = bool(get_any_value(result, key=True, file=True))
_, output_format = get_job_output_transmission(job, output_id, is_reference)
output_format = accept or output_format or result_media_type

# To ensure consistency and avoid type mismatches, all output formats are converted to a dictionary.
# This standardization prevents errors when handling cases in `get_job_results_single`
# where some formats are dictionaries and others are different types (e.g., strings or ContentType).
if not isinstance(output_format, dict):
output_format = {"mime_type": output_format}

return get_job_results_single(job, result, output_id, output_format, headers=headers, settings=settings)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is essentially the same as the end of get_job_results_response:

res_id = out_vals[0][0]
# check accept header
req_fmt = (request_headers or {}).get("accept")
out_fmt = out_transmissions[res_id][1]
out_type = get_field(results[res_id], "mime_type", search_variations=True, default=None) # a voir en debuggant
out_select = req_fmt or out_fmt or out_type # (resolution order/precedence)
out_fmt = out_select
return get_job_results_single(job, out_info, res_id, out_fmt, headers=headers, settings=settings)

Please define a function like resolve_result_single or similar, and invoke it in both places.

The output transmission check should already be done by the get_job_results_single call, with all corresponding logic to convert data/link and transforms.

Comment on lines +909 to +918
config.add_cornice_service(sd.process_jobs_service)
config.add_cornice_service(sd.process_job_service)
config.add_cornice_service(sd.process_results_service)
config.add_cornice_service(sd.process_result_value_service)
config.add_cornice_service(sd.process_outputs_service)
config.add_cornice_service(sd.process_output_service)
config.add_cornice_service(sd.process_inputs_service)
config.add_cornice_service(sd.process_exceptions_service)
config.add_cornice_service(sd.process_logs_service)
config.add_cornice_service(sd.process_stats_service)
Copy link
Collaborator

Choose a reason for hiding this comment

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

sync order with upstream branch to avoid the diff

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 WIP Work in progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants