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 58 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
07a27e7
Transformer Implementation
OlivGruwe Jun 7, 2023
3c1ef15
Transformer Implementation
OlivGruwe Jun 7, 2023
6d23b4c
Transformer Implementation +
OlivGruwe Jun 12, 2023
d85aa30
Transformer Implementation
OlivGruwe Jun 12, 2023
b02bb01
Transformer Implementation
OlivGruwe Jun 12, 2023
d7c727f
Transformer Implementation
OlivGruwe Jun 12, 2023
b3b4f52
Transformer Implementation
OlivGruwe Jun 12, 2023
dcde84e
Correction Txt -> Pdf
OlivGruwe Jul 3, 2023
d6b8c6c
Merge branch 'master' of github.com:crim-ca/weaver into job_output_tr…
Nazim-crim Sep 24, 2024
b3048bb
Fixing naming typos
Nazim-crim Sep 24, 2024
a23519e
Adding libpangocairo to dockerfile
Nazim-crim Sep 24, 2024
ee9c208
Fixing import and linting
Nazim-crim Sep 25, 2024
a8d4473
Fixing docker call and removing unused code
Nazim-crim Sep 26, 2024
574314c
Removing transformer route and test in job, fixing makefile
Nazim-crim Sep 26, 2024
0304b3a
Adding swagger and endpoint definition to support outputId and resultId
Nazim-crim Sep 26, 2024
4cf0e80
Adding in config output and result service
Nazim-crim Oct 1, 2024
81721dd
Fixing test to use transformer resource path
Nazim-crim Oct 11, 2024
e66c582
Fix transform function any to pdf and any to html for transform test …
Nazim-crim Oct 11, 2024
34cd699
Fix import lint
Nazim-crim Oct 11, 2024
fe71427
fixing some linting
Nazim-crim Oct 15, 2024
71f6f96
Adding get job output route
Nazim-crim Oct 15, 2024
34ddd87
Fxing more linting
Nazim-crim Oct 15, 2024
5fe2af0
Merge branch 'master' of github.com:crim-ca/weaver into job_output_tr…
Nazim-crim Oct 15, 2024
9fedeb7
Remove duplicate code from merge
Nazim-crim Oct 15, 2024
13d3d17
Update get job output to use get_job_results_single and refactor tran…
Nazim-crim Oct 15, 2024
bc14eac
fix docstring
Nazim-crim Oct 15, 2024
a837ff0
Fixing wps api test
Nazim-crim Oct 25, 2024
037a8a4
Fix test and transform to use conversion list and content type from f…
Nazim-crim Oct 28, 2024
a658579
Merge branch 'master' of github.com:crim-ca/weaver into job_output_tr…
Nazim-crim Oct 28, 2024
38314b6
Modify offering to add alternate formats to format in process and test
Nazim-crim Nov 5, 2024
472ac6b
Remove call of get_all_possible_formats_links in get outputs endpoint
Nazim-crim Nov 5, 2024
4ee2247
Fix wps package test and offering method for edge case where formats …
Nazim-crim Nov 5, 2024
a71187d
Fixing process test
Nazim-crim Nov 6, 2024
e6143b5
Fixing json indent
Nazim-crim Nov 6, 2024
6bfb158
Fixing typo and adding missing format in test
Nazim-crim Nov 6, 2024
7591617
Fixing pep8
Nazim-crim Nov 6, 2024
41147b0
fix single quote
Nazim-crim Nov 6, 2024
3448038
Fixing providers test and fix empty line eof
Nazim-crim Nov 6, 2024
ce4bbb3
Adding test files for different conversion
Nazim-crim Nov 7, 2024
9d823e8
Adding create content id, fixing test with additional format type
Nazim-crim Nov 7, 2024
969f76b
Adding excluded in transform and fixing link parsing
Nazim-crim Nov 8, 2024
42c772d
Fixing make result link and adding URN schema
Nazim-crim Nov 8, 2024
e4c3194
Fixing kwargs parsing
Nazim-crim Nov 8, 2024
c3b0db7
Fixing make link header and adding test, fix old test
Nazim-crim Nov 14, 2024
7544834
Merge branch 'master' of github.com:crim-ca/weaver into job_output_tr…
Nazim-crim Nov 14, 2024
a7fb477
Fixing write images and adding coverage
Nazim-crim Nov 14, 2024
bf1118d
Adding docstring and typing, fixing test to use parametrize
Nazim-crim Nov 14, 2024
3c24142
Adding change log entry and fixing import
Nazim-crim Nov 15, 2024
7c1ff74
Using smaller tests files
Nazim-crim Nov 18, 2024
e70233e
Using contentType class for test
Nazim-crim Nov 18, 2024
32bdb81
Fixing comment indent, removing unused code
Nazim-crim Nov 26, 2024
a7f8216
Wrap test in try finally
Nazim-crim Nov 29, 2024
c017929
Fixing docstring, removing unused function
Nazim-crim Nov 29, 2024
2ce3667
Fixing doc, requirements ordering and removing print
Nazim-crim Dec 12, 2024
f9aee2f
Fixing cli formating, swagger def and correcting wps_package assert
Nazim-crim Dec 18, 2024
0bc4822
modifying execute and fix import
Nazim-crim Feb 19, 2025
a2e8eee
Merge master
Nazim-crim Feb 19, 2025
216b7ea
fixing requirements
Nazim-crim Feb 19, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 35 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -228,10 +228,10 @@ conda-env-export: ## export the conda environment
install: install-all ## alias for 'install-all' target

.PHONY: install-run
install-run: conda-install install-sys install-pkg install-raw ## install requirements and application to run locally
install-run: conda-install install-sys install-pkg install-raw install-transform ## install requirements and application to run locally

.PHONY: install-all
install-all: conda-install install-sys install-pkg install-pip install-dev ## install application with all dependencies
install-all: conda-install install-sys install-pkg install-pip install-transform ## install application with all dependencies
Copy link
Collaborator

Choose a reason for hiding this comment

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

install-dev should remain here


.PHONY: install-doc
install-doc: install-pip ## install documentation dependencies
Expand Down Expand Up @@ -298,6 +298,28 @@ install-npm-remarklint: install-npm ## install remark-lint dependency for 'ch
remark-preset-lint-markdown-style-guide \
)

y.PHONY: install-transform
install-transform: install-cairo-dependencies # install-trfm-dependencies install-gdal


#.PHONY: install-gdal
#install-gdal: ## install GDAL
# @echo "Installing conda packages for GDAL"
# @bash -c '$(CONDA_CMD) conda install -c conda-forge gdal'
# @echo "Install GDAL complete."
#
#.PHONY: install-trfm-dependencies
#install-trfm-dependencies: ## install required dependencies for Transformer
# @echo "Install required dependencies for Transformer"
# @bash -c '$(CONDA_CMD) pip install --upgrade -r "$(APP_ROOT)/requirements-trfm.txt"'
# @echo "Install with pip complete."
Copy link
Collaborator

Choose a reason for hiding this comment

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

Leftover code to remove if not needed anymore.


.PHONY: install-cairo-dependencies
install-cairo-dependencies: ## install required dependencies for Transformer
@[ -f "$(shell which cairo)" ] || ( \
echo "Binary package manager cairo not found. Attempting to install it."; \
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.

Is this absolutely necessary? Installing the cairosvg package does not install its dependency for you?

I expect the Docker image will break otherwise, since this won't be installed.

)
## -- Cleanup targets ----------------------------------------------------------------------------------------------- ##

.PHONY: clean
Expand Down Expand Up @@ -532,6 +554,7 @@ check-security-deps-only: mkdir-reports ## run security checks on package depen
-r "$(APP_ROOT)/requirements-dev.txt" \
-r "$(APP_ROOT)/requirements-doc.txt" \
-r "$(APP_ROOT)/requirements-sys.txt" \
-r "$(APP_ROOT)/requirements-trfm.txt" \
$(SAFETY_IGNORE) \
1> >(tee "$(REPORTS_DIR)/check-security-deps.txt")'

Expand Down Expand Up @@ -834,6 +857,14 @@ docker-clean: ## remove all built docker images (only matching current/latest v
docker rmi -f "$(APP_NAME):latest" || true
docker rmi -f "$(APP_NAME):base" || true

.PHONY: transformer
fix-fstring-only: mkdir-reports
@echo "Fixing code string formats substitutions to f-string definitions..."
@-rm -f "$(REPORTS_DIR)/fixed-fstring.txt"
@bash -c '$(CONDA_CMD) \
flynt $(FLYNT_FLAGS) "$(APP_ROOT)" \
1> >(tee "$(REPORTS_DIR)/fixed-fstring.txt")'

## -- Launchers targets --------------------------------------------------------------------------------------------- ##

.PHONY: start
Expand All @@ -848,3 +879,5 @@ stop: ## kill application instance(s) started with gunicorn (pserve)
.PHONY: stat
stat: ## display processes with PID(s) of gunicorn (pserve) instance(s) running the application
@lsof -i :4001 || echo "No instance running"


12 changes: 6 additions & 6 deletions config/weaver.ini.example
Copy link
Collaborator

Choose a reason for hiding this comment

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

undo changes for local use
This file is used by the CI to validate functionality.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pyramid.debug_routematch = false
pyramid.default_locale_name = en

# mongodb
mongodb.host = mongodb
mongodb.host = 127.0.0.1
mongodb.port = 27017
mongodb.db_name = weaver

Expand Down Expand Up @@ -48,7 +48,7 @@ cache.quotation.enabled = true
# EMS: current instance dispatches execution to other remote ADES or WPS providers
# HYBRID: current instance does both ADES and EMS roles with flexible combinations depending on situation
weaver.configuration = HYBRID
weaver.url = http://localhost:4001
weaver.url = http://127.0.0.1:4002

# Static endpoint to external schema locations for reference in responses.
# If not provided, the current instance OpenAPI JSON path is employed instead.
Expand All @@ -63,7 +63,7 @@ weaver.log_level =
# SSL verification should be enabled for secured connections
# setting is available for convenience, debug purposes and local environments
# preferably, use specific request options
weaver.ssl_verify = true
weaver.ssl_verify = false
# file with request options to be used with 'weaver.utils.request_extra'
# see 'requests_options.yml.example'
weaver.request_options =
Expand Down Expand Up @@ -111,7 +111,7 @@ weaver.wps_output_url =
weaver.wps_output_path = /wpsoutputs
weaver.wps_output_s3_bucket =
weaver.wps_output_s3_region =
weaver.wps_workdir =
weaver.wps_workdir = /tmp/weaver/wps_workdir

# --- Weaver WPS metadata ---
# all attributes under "metadata:main" can be specified as 'weaver.wps_metadata_<field>'
Expand Down Expand Up @@ -171,7 +171,7 @@ weaver.vault_dir = /tmp/vault
###
[celery]
#USE_CELERYCONFIG = True
BROKER_URL = mongodb://mongodb:27017/celery
BROKER_URL = mongodb://127.0.0.1:27017/celery
# Result backend is required for SYNC execution.
# Using only the backend type matching the broker URL will automatically resolve to use it database location.
# For an alternative result location, provide the full backend directly rather than using "mongodb_backend_settings".
Expand All @@ -191,7 +191,7 @@ RESULT_BACKEND = mongodb

# --- gunicorn ---
use = egg:gunicorn#main
bind = 0.0.0.0:4001
bind = 127.0.0.1:4002
workers = 10
timeout = 10

Expand Down
10 changes: 10 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,13 @@ typing_extensions
WebTest
wsgiproxy
WSGIProxy2

# transformer
fpdf
Pillow
pandas
cairosvg
multipagetiff
# gdal
rasterio
python-magic
Copy link
Collaborator

Choose a reason for hiding this comment

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

The Makefile refers to a requirements-trfm.txt file. Those should be moved into that file. It can then be embedded in this file using -r requirements-trfm.txt (as done in the top).

11 changes: 11 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ json2xml<3.19.0; python_version <= "3.6" # pyup: ignore
# reduced dependencies contrains to let packages update to latest (https://github.com/vinitkumar/json2xml/issues/157)
json2xml>=3.20.0; python_version >= "3.7"
jsonschema>=3.0.1

# FIXME: kombu for pymongo>=4 not yet released as 5.3.0 (only pre-releases available)
# - https://github.com/crim-ca/weaver/issues/386
# - https://github.com/celery/kombu/pull/1536
Expand Down Expand Up @@ -101,3 +102,13 @@ urlmatch
xmltodict
webob
werkzeug>2

# transformer
fpdf
Pillow
pandas
cairosvg
multipagetiff
# gdal
rasterio
python-magic
Copy link
Collaborator

Choose a reason for hiding this comment

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

Reuse -r requirements-trfm.txt as in previous comment.

2 changes: 2 additions & 0 deletions tests/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
TEST_REMOTE_SERVER_URL, WPS_NO_INPUTS_ID
)

WPS_TRANFORM_RESSOURCES = os.path.join(RESOURCES_PATH, "transform")


def _load_path(file_path, text=False, xml=False):
# type: (str, bool, bool) -> Union[JSON, xml_util.XML, str]
Expand Down
Loading