crim-ca / weaver

Weaver: Workflow Execution Management Service (EMS); Application, Deployment and Execution Service (ADES); OGC API - Processes; WPS; CWL Application Package
https://pavics-weaver.readthedocs.io
Apache License 2.0
23 stars 6 forks source link

Fix `convert_input_values_schema` for multiple values #530

Closed francisPLT closed 1 year ago

francisPLT commented 1 year ago

Initial problem was found while trying to execute a process through the CLI, using in it's inputs an array of three or more elements all using the same input ID.

The problem was isolated to the convert_input_values_schema function.

Under the OGC schema, when building the list for repeated IDs, the function simply added the previous list to a new list:

# Old
input_prev = input_dict[input_id]
input_dict[input_id] = [input_prev, input_data]

Trying to add to input_dict a second element worked fine, but when adding a third, the result became [[input_prev], input_date]

Added a small check to convert input_prev if not already a list and switched to an append function.

Tests were adjusted to include lists of more than 2 elements and everything seems alright.

Also tested with my initial process and it also succeeded.

codecov[bot] commented 1 year ago

Codecov Report

Merging #530 (bb2e0f7) into master (ac1df40) will increase coverage by 0.00%. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #530   +/-   ##
=======================================
  Coverage   84.29%   84.29%           
=======================================
  Files          78       78           
  Lines       16862    16865    +3     
  Branches     2564     2565    +1     
=======================================
+ Hits        14213    14216    +3     
  Misses       1952     1952           
  Partials      697      697           
Impacted Files Coverage Δ
weaver/processes/convert.py 83.61% <100.00%> (+0.03%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.