AI-Planning / planning-as-a-service

The newly improved planner (and more) in the cloud.
Apache License 2.0
30 stars 8 forks source link

Docker comseup erroer when run celery-queue dockerfile #25

Closed YourHarbour closed 2 years ago

YourHarbour commented 2 years ago

I follow the Readme but meet the errors that:

`harbour@Harbour-Desktop:/planning-as-a-service/server$ docker-compose up -d --build Building monitor Step 1/12 : FROM aiplanning/planutils:latest ---> e79d3ffc5556 Step 2/12 : ENV CELERY_BROKER_URL redis://redis:6379/0 ---> Using cache ---> 501aad79c50e Step 3/12 : ENV CELERY_RESULT_BACKEND redis://redis:6379/0 ---> Using cache ---> 70db2b35d4d9 Step 4/12 : ENV C_FORCE_ROOT true ---> Using cache ---> 76b8ec220e7b Step 5/12 : ENV WEB_DOCKER_URL web ---> Using cache ---> 570cfd9aeb75 Step 6/12 : ENV PATH=$PATH:~/.planutils/bin ---> Using cache ---> 9ae6c7ce6ffb Step 7/12 : COPY . /queue ---> Using cache ---> 21b374c61a8c Step 8/12 : WORKDIR /queue ---> Using cache ---> efde68772a6a Step 9/12 : RUN planutils install -f lama-first ---> Running in 7687d2a07118 bash: cannot set terminal process group (1): Inappropriate ioctl for device bash: no job control in this shell lama-first will be installed.

About to install the following packages: downward (36M), lama-first (20K) Proceed? [Y/n] Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python3.6/dist-packages/planutils/init.py", line 109, in main exit({True:0, False:1}[install(args.package, args.force, args.yes)]) File "/usr/local/lib/python3.6/dist-packages/planutils/package_installation.py", line 154, in install user_response = input(" Proceed? [Y/n] ").lower() in ['', 'y', 'yes'] EOFError: EOF when reading a line ERROR: Service 'monitor' failed to build: The command '/bin/sh -c planutils install -f lama-first' returned a non-zero code: 1 `

This happened in \planning-as-a-service\server\celery-queue\dockerfile line 14, both lama-first and line 15 kstar will raise the issue. If remove them the docker will run but the website shows Internal Server Error.

IF i follow Local Dev, the website will run correctly but no result is calculated, errors happen in flower tracktrace: Traceback (most recent call last): File "/home/harbour/planning-as-a-service/server/env/lib/python3.8/site-packages/celery/app/trace.py", line 451, in trace_task R = retval = fun(*args, **kwargs) File "/home/harbour/planning-as-a-service/server/env/lib/python3.8/site-packages/celery/app/trace.py", line 734, in __protected_call__ return self.run(*args, **kwargs) File "/home/harbour/planning-as-a-service/server/celery-queue/tasks.py", line 62, in solve plan = retrieve_output_file(PACKAGES[solver]['endpoint']['return']['file'], tmpfolder) KeyError: 'endpoint' If I use the example python post in Readme, the error will happen too: harbour@Harbour-Desktop:~/planning-as-a-service$ python3 test.py Traceback (most recent call last): File "test.py", line 10, in <module> solve_request = requests.post("http://localhost:5001/package/lama-first/solve", json=req_body).json() File "/home/harbour/.local/lib/python3.8/site-packages/requests/models.py", line 898, in json return complexjson.loads(self.text, **kwargs) File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 518, in loads return _default_decoder.decode(s) File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Any way to solve it?

haz commented 2 years ago

@YIDING-CODER ?

@YourHarbour : Can you confirm which branch you're using?

YIDING-CODER commented 2 years ago

Hi @YourHarbour,

There are only two banches, and I am developing on branch "planutils-functionality".

  1. Delete "planutils install lama-first" will solve the first issue. We will have to updated the docker file at later stage to make this line working.
  2. You get the endpoint error is because the planutils installed is not up to date. The latest one is on the development branch "manifest-new-version" Currently, I manually update the planutils and install the packages once the docker container is built. You can find the instructions here .

Thank you. Regards, Yi

YourHarbour commented 2 years ago

Hi @YourHarbour,

There are only two banches, and I am developing on branch "planutils-functionality".

  1. Delete "planutils install lama-first" will solve the first issue. We will have to updated the docker file at later stage to make this line working.
  2. You get the endpoint error is because the planutils installed is not up to date. The latest one is on the development branch "manifest-new-version" Currently, I manually update the planutils and install the packages once the docker container is built. You can find the instructions here .

Thank you. Regards, Yi

Hi @YIDING-CODER ,

I've tried the ways you suggest, but the system still shows errors in 'endpoint' Here is my process: ` docker-compose up -d --build sudo docker exec -it 68505094fed6 bash git clone https://github.com/AI-Planning/planutils.git cd planutils git checkout manifest-new-version pip uninstall planutils python3 setup.py install --old-and-unmanageable planutils setup planutils install lama exit

sudo docker exec -it 28cff43edb2a bash git clone https://github.com/AI-Planning/planutils.git cd planutils git checkout manifest-new-version pip uninstall planutils python3 setup.py install --old-and-unmanageable planutils setup planutils install lama exit `

After that I restart the docker and server, when I select files in http://localhost:5001/solver/, the flower show error:

` Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/celery/app/trace.py", line 412, in trace_task R = retval = fun(*args, *kwargs) File "/usr/local/lib/python3.6/dist-packages/celery/app/trace.py", line 704, in __protected_call__ return self.run(args, **kwargs) File "/queue/tasks.py", line 62, in solve plan = retrieve_output_file(PACKAGES[solver]['endpoint']['return']['file'], tmpfolder) KeyError: 'return'

`

YIDING-CODER commented 2 years ago

Hi @YourHarbour,

I think you did the right thing. I forgot to tell you the solver endpoint is not working currently, and it is not up to date. If I remember correctly, we will be forwarding the request to a pakcage endpoint in fututre. For example, /solve request will be send to package/lama-first/solve.

You can find how to use package endpoint in read me here.

Thank you. Regards, Yi

YourHarbour commented 2 years ago

Hi @YIDING-CODER ,

I've tried the script within the container and out of the container, but both of them show the same error:

harbour@BoFans-MacBook-Pro desktop % python3 test.py Traceback (most recent call last): File "/Users/harbour/Desktop/test.py", line 153, in <module> solve_request = requests.post("http://localhost:5001/package/lama/solve", json=req_body).json() File "/opt/homebrew/lib/python3.9/site-packages/requests/models.py", line 910, in json return complexjson.loads(self.text, **kwargs) File "/opt/homebrew/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/__init__.py", line 346, in loads return _default_decoder.decode(s) File "/opt/homebrew/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/opt/homebrew/Cellar/python@3.9/3.9.9/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

could you help me with this? thank you!

YIDING-CODER commented 2 years ago

Hi @YourHarbour, Can you please share the test.py with me?

YourHarbour commented 2 years ago

Hi @YourHarbour, Can you please share the test.py with me?

Sure @YIDING-CODER , here it is:

` import requests import time from pprint import pprint

req_body = { "domain":"(define (domain BLOCKS) (:requirements :strips) (:predicates (on ?x ?y) (ontable ?x) (clear ?x) (handempty) (holding ?x) ) (:action pick-up :parameters (?x) :precondition (and (clear ?x) (ontable ?x) (handempty)) :effect (and (not (ontable ?x)) (not (clear ?x)) (not (handempty)) (holding ?x))) (:action put-down :parameters (?x) :precondition (holding ?x) :effect (and (not (holding ?x)) (clear ?x) (handempty) (ontable ?x))) (:action stack :parameters (?x ?y) :precondition (and (holding ?x) (clear ?y)) :effect (and (not (holding ?x)) (not (clear ?y)) (clear ?x) (handempty) (on ?x ?y))) (:action unstack :parameters (?x ?y) :precondition (and (on ?x ?y) (clear ?x) (handempty)) :effect (and (holding ?x) (clear ?y) (not (clear ?x)) (not (handempty)) (not (on ?x ?y)))))", "problem":"(define (problem BLOCKS-4-0) (:domain BLOCKS) (:objects D B A C ) (:INIT (CLEAR C) (CLEAR A) (CLEAR B) (CLEAR D) (ONTABLE C) (ONTABLE A) (ONTABLE B) (ONTABLE D) (HANDEMPTY)) (:goal (AND (ON D C) (ON C B) (ON B A))) )" }

solve_request = requests.post("http://localhost:5001/package/lama/solve", json=req_body).json()

celery_result = requests.get('http://localhost:5001' + solve_request['result'])

print('Computing...') while celery_result.text == 'PENDING': celery_result = requests.get('http://localhost:5001' + solve_request['result']) time.sleep(0.5)

pprint(celery_result.json()) `

YIDING-CODER commented 2 years ago

Hi @YourHarbour, The code is runable on my Mac, I think something wrong with your python? Can you try to send request through Postman? So we can make sure the server is working.

YourHarbour commented 2 years ago

Hi @YourHarbour, The code is runable on my Mac, I think something wrong with your python? Can you try to send request through Postman? So we can make sure the server is working.

Hi @YIDING-CODER , maybe it's a dumb question, but what do I need to post to the URL? Im new to the postman and not sure how to use it. Sorry for that.

Screen Shot 2022-03-06 at 17 21 42
YIDING-CODER commented 2 years ago

Hi @YourHarbour ,

All good! Try this:

Screen Shot 2022-03-06 at 5 27 10 pm
YourHarbour commented 2 years ago

Hi @YourHarbour ,

All good! Try this: Screen Shot 2022-03-06 at 5 27 10 pm

Hi @YIDING-CODER I've tried it but it still shows Interneal server error.

Screen Shot 2022-03-06 at 17 30 02

But I'm sure that all docker container are running.

Screen Shot 2022-03-06 at 17 31 05
YIDING-CODER commented 2 years ago

Hi @YourHarbour , Can you please check the logs in server_web_1 container? What error is shown here?

YourHarbour commented 2 years ago

Hi @YourHarbour , Can you please check the logs in server_web_1 container? What error is shown here?

Hi @YIDING-CODER , Here it is:

Screen Shot 2022-03-06 at 17 39 01
YIDING-CODER commented 2 years ago

Hi @YourHarbour ,

I think you deployed the wrong branch(Master branch is not up to date)? You have to rebuild the contatiner with the code in the latest branch(planutils-functionality).

Good luck, if it is not working, I can make a video for you.

YourHarbour commented 2 years ago

Hi @YourHarbour ,

I think you deployed the wrong branch(Master branch is not up to date)? You have to rebuild the contatiner with the code in the latest branch(planutils-functionality).

  • Switch to the planutils-funcitonality branch
  • rebuild the docker containers: docker-compose up --build
  • login to the contationers, update the planutils manually and install lama
  • try again with Postman

Good luck, if it is not working, I can make a video for you.

Thank you, I will have a try!

YourHarbour commented 2 years ago

Hi @YourHarbour ,

I think you deployed the wrong branch(Master branch is not up to date)? You have to rebuild the contatiner with the code in the latest branch(planutils-functionality).

  • Switch to the planutils-funcitonality branch
  • rebuild the docker containers: docker-compose up --build
  • login to the contationers, update the planutils manually and install lama
  • try again with Postman

Good luck, if it is not working, I can make a video for you.

Hi @YIDING-CODER , I've meet up a brand new problem when build the docker:

Screen Shot 2022-03-06 at 17 59 35

It seems that TIME_LIMIT=int(os.environ.get('TIME_LIMIT', 20)) is invalid.

YIDING-CODER commented 2 years ago

Hi @YourHarbour ,

Can you please create an .env file in the folder with docker-compose file? It's documented in the readme here as well:)

Screen Shot 2022-03-06 at 6 04 59 pm

try again, once you created .env file.

YourHarbour commented 2 years ago

Hi @YourHarbour ,

Can you please create an .env file in the folder with docker-compose file? It's documented in the readme here as well:) Screen Shot 2022-03-06 at 6 04 59 pm

try again, once you created .env file.

Hi @YIDING-CODER ,no errors again, I will try to update the planutils manually and install lama, do I need to restart the docker container when installed?

YourHarbour commented 2 years ago

Hi @YourHarbour ,

Can you please create an .env file in the folder with docker-compose file? It's documented in the readme here as well:) Screen Shot 2022-03-06 at 6 04 59 pm

try again, once you created .env file.

Hi, @YIDING-CODER It works! But the result shows an error:

Screen Shot 2022-03-06 at 18 20 38 Screen Shot 2022-03-06 at 18 21 10
YIDING-CODER commented 2 years ago

@YourHarbour, have you updated the planutils in both server_web1 and server_worker1 container?

YourHarbour commented 2 years ago

@YourHarbour, have you updated the planutils in both server_web1 and server_worker1 container?

Hi @YIDING-CODER , I've checked the command history that I updated them already

YIDING-CODER commented 2 years ago

Hi @YourHarbour, Can you please try other solvers? Sometime it is the solver's issue.

Here are the list of planners you can try: lama-first, dual-bfws-fdparser,dual-bfws-ffparser,cerberus-sat,enhsp-2020

YourHarbour commented 2 years ago

Hi @YourHarbour, Can you please try other solvers? Sometime it is the solver's issue.

Here are the list of planners you can try: lama-first, dual-bfws-fdparser,dual-bfws-ffparser,cerberus-sat,enhsp-2020

Hi @YIDING-CODER ,

I've tried all the solver you mentioned above, but all of them shows the same error:

Screen Shot 2022-03-08 at 18 35 43

Could you please make a video on how to use it? Here is my WeChat account: Harbour_Zhang, maybe we can chat on it?

Thank you!

haz commented 2 years ago

Can you post the full error? Looks like something is failing to even run that part of the kube setup, but it's hard to see. Are you sure everything spins up ok?

If possible, I'd suggest keeping the conversation thread here, as it's beneficial for myself and any other devs keeping tabs on this.

YourHarbour commented 2 years ago

Can you post the full error? Looks like something is failing to even run that part of the kube setup, but it's hard to see. Are you sure everything spins up ok?

If possible, I'd suggest keeping the conversation thread here, as it's beneficial for myself and any other devs keeping tabs on this.

Hi,

I found the issue:

The M1(ARM-based CPU) MAC has not supported some functions in the docker container and caused the problem, I used another x64 machine and everything was fine, thank you!

haz commented 2 years ago

Thanks for tracking this down!

@YIDING-CODER : would be great if you could add a warning about this in the documentation

YIDING-CODER commented 2 years ago

I have updated the Readme in the development branch.