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

module does not work once deployed to kubernetes #1345

Closed
nyejon opened this issue Jan 17, 2020 · 1 comment
Closed

module does not work once deployed to kubernetes #1345

nyejon opened this issue Jan 17, 2020 · 1 comment
Labels
bug triage Needs to be triaged and prioritised accordingly

Comments

@nyejon
Copy link

nyejon commented Jan 17, 2020

Hi,

I have wrapped a model, and when doing "docker run model_image" locally after building the image, the server starts with no import errors.

However, once I try and run the image on kubernetes I get this error in the pod logs:

seldon_core.microservice:main:265 - INFO: Importing submodule ['nlppipeline.nlppipeline', 'NLPPipeline']
/
Traceback (most recent call last):
File "/usr/local/bin/seldon-core-microservice", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.7/site-packages/seldon_core/microservice.py", line 266, in main
interface_file = importlib.import_module(parts[0])
File "/usr/local/lib/python3.7/importlib/init.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1006, in _gcd_import
File "", line 983, in _find_and_load
File "", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'nlppipeline.nlppipeline'

I'm a bit stuck what the problem could be.

I am trying to call the seldon-core-microservice with the following command:

seldon-core-microservice nlppipeline.NLPPipeline REST --service-type MODEL --persistence 0

It differs from the examples that I am calling it from outside the module, rather than the example using the "NLPPipeline" as the model name directly.

@nyejon nyejon added bug triage Needs to be triaged and prioritised accordingly labels Jan 17, 2020
@nyejon
Copy link
Author

nyejon commented Jan 17, 2020

OK, I got this working.

If you use a module, for some reason the base python path is seen as the root directory in docker.

Therefore, to get the module working one has to not change the WORKDIR in docker and use the full path as the model name.

Here is an example of the new Dockerfile:

FROM python:3.7

ENV PYTHONUNBUFFERED 1
# copying source files into app folder of container
RUN pip install --upgrade pip pipenv
COPY ["Pipfile", "Pipfile.lock", "./"]
# installing requirements.txt with pipenv
RUN pipenv install --system --deploy

COPY . /src/model_template

EXPOSE 5000

# Define environment variable
ENV MODEL_NAME src.model_template.BaseSeldonModel.BaseSeldonModel
ENV API_TYPE REST
ENV SERVICE_TYPE MODEL
ENV PERSISTENCE 0
ENV LOG_LEVEL_ENV DEBUG

CMD exec seldon-core-microservice $MODEL_NAME $API_TYPE --service-type $SERVICE_TYPE --persistence $PERSISTENCE --log-level $LOG_LEVEL_ENV

@nyejon nyejon closed this as completed Jan 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug triage Needs to be triaged and prioritised accordingly
Projects
None yet
Development

No branches or pull requests

1 participant