elixir-cloud-aai / proWES

Proxy service for injecting middleware into GA4GH WES requests
Apache License 2.0
3 stars 5 forks source link

fix: POST /runs 400 error #91

Open JaeAeich opened 9 months ago

JaeAeich commented 9 months ago

Describe the bug POST /runs throws a 400 error.

Request:

curl \
  -X POST \
  "http://localhost:8090/ga4gh/wes/v1/runs" \
  -H "accept: application/json" \
  -H "Content-Type: multipart/form-data" \
  -F "tags=" \
  -F "workflow_attachment=" \
  -F "workflow_engine_parameters=" \
  -F 'workflow_params={"input":{"class":"File","path":"https://is.muni.cz/pics/design/r/znak_MU.png"}}' \
  -F "workflow_type=CWL" \
  -F "workflow_type_version=v1.0" \
  -F "workflow_url=https://github.com/uniqueg/cwl-example-workflows/blob/master/hashsplitter-workflow.cwl"

Response:

{
  "message": "No suitable workflow engine known.",
  "code": "400"
}

Traceback:

[2024-02-04 17:49:09,277: ERROR   ] {'message': 'No suitable workflow engine known.', 'code': '400'} [foca.errors.exceptions]
[2024-02-04 17:49:09,281: ERROR   ] Traceback (most recent call last):\n  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1823, in full_dispatch_request\n    rv = self.dispatch_request()\n  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1799, in dispatch_request\n    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)\n  File "/usr/local/lib/python3.10/site-packages/connexion/decorators/decorator.py", line 68, in wrapper\n    response = function(request)\n  File "/usr/local/lib/python3.10/site-packages/connexion/decorators/uri_parsing.py", line 149, in wrapper\n    response = function(request)\n  File "/usr/local/lib/python3.10/site-packages/connexion/decorators/validation.py", line 196, in wrapper\n    response = function(request)\n  File "/usr/local/lib/python3.10/site-packages/connexion/decorators/parameter.py", line 120, in wrapper\n    return function(**kwargs)\n  File "/usr/local/lib/python3.10/site-packages/foca/utils/logging.py", line 61, in _wrapper\n    response = fn(*args, **kwargs)\n  File "/app/pro_wes/ga4gh/wes/controllers.py", line 64, in RunWorkflow\n    response = workflow_run.run_workflow(\n  File "/app/pro_wes/ga4gh/wes/workflow_runs.py", line 81, in run_workflow\n    document.run_log.request = self._validate_run_request(\n  File "/app/pro_wes/ga4gh/wes/workflow_runs.py", line 468, in _validate_run_request\n    model_instance = RunRequest(**dict_atomic)\n  File "pydantic/main.py", line 339, in pydantic.main.BaseModel.__init__\n  File "pydantic/main.py", line 1102, in pydantic.main.validate_model\n  File "/app/pro_wes/ga4gh/wes/models.py", line 195, in workflow_type_and_version_supported\n    raise NoSuitableEngine(\npro_wes.exceptions.NoSuitableEngine: 400 Bad Request: No suitable workflow engine known for workflow type 'CWL' and version 'v1.0'; supported workflow engines: {'additionalProp1': {'workflow_type_version': ['string']}, 'additionalProp2': {'workflow_type_version': ['string']}, 'additionalProp3': {'workflow_type_version': ['string']}} [foca.errors.exceptions]

I don't think this is due to the latest commits, I have checked it for commits from 25f0e59 fix: create storage dir on startup (#83 to as back as fe8271a build: upgrade FOCA (#64), which is weird because it did use to work sometimes back, maybe a foca error.

To Reproduce Steps to reproduce the behavior: I ran POST request from swagger on 8090.

JaeAeich commented 9 months ago

TLDR

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1823, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.10/site-packages/flask/app.py", line 1799, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
  File "/usr/local/lib/python3.10/site-packages/connexion/decorators/decorator.py", line 68, in wrapper
    response = function(request)
  File "/usr/local/lib/python3.10/site-packages/connexion/decorators/uri_parsing.py", line 149, in wrapper
    response = function(request)
  File "/usr/local/lib/python3.10/site-packages/connexion/decorators/validation.py", line 196, in wrapper
    response = function(request)
  File "/usr/local/lib/python3.10/site-packages/connexion/decorators/parameter.py", line 120, in wrapper
    return function(**kwargs)
  File "/usr/local/lib/python3.10/site-packages/foca/utils/logging.py", line 61, in _wrapper
    response = fn(*args, **kwargs)
  File "/app/pro_wes/ga4gh/wes/controllers.py", line 64, in RunWorkflow
    response = workflow_run.run_workflow(
  File "/app/pro_wes/ga4gh/wes/workflow_runs.py", line 81, in run_workflow
    document.run_log.request = self._validate_run_request(
  File "/app/pro_wes/ga4gh/wes/workflow_runs.py", line 468, in _validate_run_request
    model_instance = RunRequest(**dict_atomic)
  File "pydantic/main.py", line 339, in pydantic.main.BaseModel.__init__
  File "pydantic/main.py", line 1102, in pydantic.main.validate_model
  File "/app/pro_wes/ga4gh/wes/models.py", line 195, in workflow_type_and_version_supported
    raise NoSuitableEngine(
pro_wes.exceptions.NoSuitableEngine: 400 Bad Request: No suitable workflow engine known for workflow type 'CWL' and version 'v1.0'; supported workflow engines: {'additionalProp1': {'workflow_type_version': ['string']}, 'additionalProp2': {'workflow_type_version': ['string']}, 'additionalProp3': {'workflow_type_version': ['string']}} [foca.errors.exceptions]
uniqueg commented 9 months ago

Hi @JaeAeich: Obviously the workflow engines configured for the deployment you are working on are wrong:

Supported workflow engines: {'additionalProp1': {'workflow_type_version': ['string']}, 'additionalProp2': {'workflow_type_version': ['string']}, 'additionalProp3': {'workflow_type_version': ['string']}}

This looks like JSON schema / OpenAPI dummy data.

Actually, proWES is really not done - the controllers just aren't really implemented yet. So this may actually be working "as expected" :unamused: