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

Redirect Issues in cli calls #217

Open
jakevc opened this issue Dec 5, 2022 · 4 comments
Open

Redirect Issues in cli calls #217

jakevc opened this issue Dec 5, 2022 · 4 comments
Labels
Bug Something isn't working

Comments

@jakevc
Copy link

jakevc commented Dec 5, 2022

Problem description

Some CLI commands fail with redirection issues associated with the route http://localhost:80/api/v1/ui. It appears as the intended route is http://localhost:80/api/v1, but is redirected http://localhost:80/api/v1/ui.

Steps to reproduce the issue

Using the nlp-cli version:

$ nlp-cli --version
nlp-cli, version 4.3.1
  1. After starting the date-annotator-example running a number of the CLI command produces similar errors to the following:
nlp-cli tool get-tool --annotator_host http://localhost:80/api/v1
Traceback (most recent call last):
  File "/Users/jake.vancampenprovidence.org/miniconda3/envs/nlpsandbox/bin/nlp-cli", line 8, in <module>
    sys.exit(main())
  File "/Users/jake.vancampenprovidence.org/miniconda3/envs/nlpsandbox/lib/python3.9/site-packages/nlpsandboxclient/cli/__main__.py", line 19, in main
    cli()
  File "/Users/jake.vancampenprovidence.org/miniconda3/envs/nlpsandbox/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/jake.vancampenprovidence.org/miniconda3/envs/nlpsandbox/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/jake.vancampenprovidence.org/miniconda3/envs/nlpsandbox/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/jake.vancampenprovidence.org/miniconda3/envs/nlpsandbox/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/jake.vancampenprovidence.org/miniconda3/envs/nlpsandbox/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/jake.vancampenprovidence.org/miniconda3/envs/nlpsandbox/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/jake.vancampenprovidence.org/miniconda3/envs/nlpsandbox/lib/python3.9/site-packages/nlpsandboxclient/cli/tool.py", line 51, in get_tool
    tool = client.get_tool(host=annotator_host)
  File "/Users/jake.vancampenprovidence.org/miniconda3/envs/nlpsandbox/lib/python3.9/site-packages/nlpsandboxclient/client.py", line 533, in get_tool
    configuration = utils.get_api_configuration(host=host)
  File "/Users/jake.vancampenprovidence.org/miniconda3/envs/nlpsandbox/lib/python3.9/site-packages/nlpsandboxclient/utils.py", line 108, in get_api_configuration
    check_url(url=os.path.join(host, "ui"))
  File "/Users/jake.vancampenprovidence.org/miniconda3/envs/nlpsandbox/lib/python3.9/site-packages/nlpsandboxclient/utils.py", line 66, in check_url
    raise ValueError(f"{url} not implemented")
ValueError: http://localhost:80/api/v1/ui not implemented

Expected behavior

  • no error

Extra information

@jakevc jakevc added the Bug Something isn't working label Dec 5, 2022
@tschaffter
Copy link
Member

Thanks for reporting this ticket. Does the redirection issue occur with the data node and/or NLP tools?

@jakevc
Copy link
Author

jakevc commented Dec 8, 2022

It looks like this is specific to the github.com/nlpsandbox/date-annotator-example, so maybe I should have opened the issue there. I am able to successfully use the datanode APIs.

@tschaffter
Copy link
Member

tschaffter commented Dec 8, 2022

I can't reproduce this issue. I used the image docker.synapse.org/syn22277123/date-annotator-example:1.2.0 pulled from Synapse. The date annotator was started locally by cloning its repo and running docker compose up.

[ec2-user@ip-10-41-30-136 date-annotator-example]$ nlp-cli --version
nlp-cli, version 4.3.1
[ec2-user@ip-10-41-30-136 date-annotator-example]$ nlp-cli tool get-tool --annotator_host http://localhost:80/api/v1
{'name': 'date-annotator-example', 'version': '1.2.0', 'license': 'apache-2.0', 'repository': 'github:nlpsandbox/date-annotator-example', 'description': 'Example implementation of the NLP Sandbox Date Annotator API', 'author': 'NLP Sandbox Team', 'author_email': 'team@nlpsandbox.io', 'url': 'https://github.com/nlpsandbox/date-annotator-example', 'type': 'nlpsandbox:date-annotator', 'api_version': '1.2.0'}

@jakevc Could you please give it another try? At the level of the code, both the date annotator and the person name annotator, for example, redirect the root path / to /api/v1/tool.

@jakevc
Copy link
Author

jakevc commented Dec 14, 2022

Yeah so I tried getting a fresh clone of the date annotator and the same thing happens. I have the data node and the workflow orchestrator running, and then I run

git clone https://github.com/nlpsandbox/date-annotator-example.git
cd date-annotator-example
docker-compose up -d

That is successful and I have all the containers running on the same machine:

$ docker container ls
CONTAINER ID   IMAGE                                                         COMMAND                  CREATED         STATUS         PORTS                  NAMES
0a535e2d9c34   nginx:1.19.6-alpine                                           "/docker-entrypoint.…"   2 minutes ago   Up 2 minutes   0.0.0.0:80->80/tcp     nginx
caaf7b4addc1   docker.synapse.org/syn22277123/date-annotator-example:1.2.0   "/docker-entrypoint.…"   2 minutes ago   Up 2 minutes                          date-annotator
214ef8cb26a9   sagebionetworks/synapse-workflow-orchestrator:1.3             "/usr/local/bin/mvn-…"   3 minutes ago   Up 3 minutes                          workflow_orchestrator-workflow-orchestrator-1
377834a45f19   nginx:1.19.6-alpine                                           "/docker-entrypoint.…"   13 days ago     Up 8 days      0.0.0.0:8080->80/tcp   data-node-nginx
457dcdbd9edc   nlpsandbox/data-node:1.2.1                                    "/docker-entrypoint.…"   13 days ago     Up 8 days                             data-node
5b5d0cc9a735   sagebionetworks/mongo:4.4.4                                   "docker-entrypoint.s…"   13 days ago     Up 8 days                             data-node-db
$ nlp-cli --version
nlp-cli, version 4.3.1

Okay check, then try and get-tool:

nlp-cli tool get-tool --annotator_host http://localhost:80/api/v1
Traceback (most recent call last):
  File "/Users/jake.vancampenprovidence.org/miniconda3/envs/nlpsandbox/bin/nlp-cli", line 8, in <module>
    sys.exit(main())
  File "/Users/jake.vancampenprovidence.org/miniconda3/envs/nlpsandbox/lib/python3.9/site-packages/nlpsandboxclient/cli/__main__.py", line 19, in main
    cli()
  File "/Users/jake.vancampenprovidence.org/miniconda3/envs/nlpsandbox/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/Users/jake.vancampenprovidence.org/miniconda3/envs/nlpsandbox/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/Users/jake.vancampenprovidence.org/miniconda3/envs/nlpsandbox/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/jake.vancampenprovidence.org/miniconda3/envs/nlpsandbox/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/jake.vancampenprovidence.org/miniconda3/envs/nlpsandbox/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/jake.vancampenprovidence.org/miniconda3/envs/nlpsandbox/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/Users/jake.vancampenprovidence.org/miniconda3/envs/nlpsandbox/lib/python3.9/site-packages/nlpsandboxclient/cli/tool.py", line 51, in get_tool
    tool = client.get_tool(host=annotator_host)
  File "/Users/jake.vancampenprovidence.org/miniconda3/envs/nlpsandbox/lib/python3.9/site-packages/nlpsandboxclient/client.py", line 533, in get_tool
    configuration = utils.get_api_configuration(host=host)
  File "/Users/jake.vancampenprovidence.org/miniconda3/envs/nlpsandbox/lib/python3.9/site-packages/nlpsandboxclient/utils.py", line 108, in get_api_configuration
    check_url(url=os.path.join(host, "ui"))
  File "/Users/jake.vancampenprovidence.org/miniconda3/envs/nlpsandbox/lib/python3.9/site-packages/nlpsandboxclient/utils.py", line 66, in check_url
    raise ValueError(f"{url} not implemented")
ValueError: http://localhost:80/api/v1/ui not implemented

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants