PathologyDataScience / HistomicsML2

A tool for training machine-learning models with whole-slide imaging datasets
22 stars 5 forks source link

Run a docker in a different port #66

Closed slee172 closed 3 years ago

slee172 commented 3 years ago

Thanks!

I changed the port in the example instruction (https://histomicsml2.readthedocs.io/en/latest/example-data.html) from 80 to 8880 using and ran it in my server docker run --net hmlnet -i -t -p 8880:80 -p 6379:6379 --link hmldb --name hml cancerdatascience/histomicsml:example /bin/bash

Then I sshed into port 8880 from my local computer.

I can access the histomicsML interface from localhost:8880\HistomicsML.

But after I select the BRCA data and start a session, the image does not load

image

Any advice on where to look to solve this?

Originally posted by @Reasat in https://github.com/CancerDataScience/HistomicsML2/issues/65#issuecomment-724809120

slee172 commented 3 years ago

@Reasat I think that the slide location has been changed. Can you see a file 'hostspecs.php' under the directory '/var/www/html/HistomicsML/php'. Try to find $IIPServer inside the file and then change the address.

Reasat commented 3 years ago

The file content is

<?php
        # !!!!!
        # !!!!! The one and ONLY place the active learning server is defined
        # !!!!!
        $port = 10000;
        $host = "localhost";

        #
        #       IIP server
        #
        $IIPServer = "http://localhost/iipsrv/iipsrv.fcgi?";
?>

I am not sure what should be the accurate address. Should it point to a folder?

slee172 commented 3 years ago

@Reasat I think you should change both @host and @IIPServer to "localhost:8880" and "http://localhost:8880/iipsrv/iipsrv.fcgi?"

Reasat commented 3 years ago

Thanks, that worked!

After selecting 4 positive and negative examples and clicking prime, it throws an error

train  Session Start .....
Traceback (most recent call last):
  File "run_model_server.py", line 1153, in <module>
    run()
  File "run_model_server.py", line 804, in run
    a_imgs = agen.prepare_image(init_sample['aurl'], slide_mean, slide_std)
  File "/src/gitrepo/predict-rest-api/augments.py", line 114, in prepare_image
    cStringIO.StringIO(urllib.urlopen(aurl).read())
  File "/usr/lib/python2.7/urllib.py", line 87, in urlopen
    return opener.open(url)
  File "/usr/lib/python2.7/urllib.py", line 215, in open
    return getattr(self, name)(url)
  File "/usr/lib/python2.7/urllib.py", line 352, in open_http
    h.endheaders(data)
  File "/usr/lib/python2.7/httplib.py", line 1078, in endheaders
    self._send_output(message_body)
  File "/usr/lib/python2.7/httplib.py", line 894, in _send_output
    self.send(msg)
  File "/usr/lib/python2.7/httplib.py", line 856, in send
    self.connect()
  File "/usr/lib/python2.7/httplib.py", line 833, in connect
    self.timeout, self.source_address)
  File "/usr/lib/python2.7/socket.py", line 575, in create_connection
    raise err
IOError: [Errno socket error] [Errno 99] Cannot assign requested address

Do I need to change the port information in any other location of the code?

slee172 commented 3 years ago

Sounds good. The remaining place you may have to correct is "setting.py" under the directory you ran "python run_model_server.py". There will be "self.REDIS_HOST = "localhost", so change it for your port.

Reasat commented 3 years ago

I did that (changed self.REDIS_HOST = "localhost" to self.REDIS_HOST = "localhost:8880") but it is still throwing an error

Traceback (most recent call last):
  File "run_model_server.py", line 1153, in <module>
    run()
  File "run_model_server.py", line 74, in run
    queue = db.lrange(set.REQUEST_QUEUE, set.REQUEST_START, set.REQUEST_END)
  File "/usr/local/lib/python2.7/dist-packages/redis/client.py", line 1975, in lrange
    return self.execute_command('LRANGE', name, start, end)
  File "/usr/local/lib/python2.7/dist-packages/redis/client.py", line 898, in execute_comm
and
    conn = self.connection or pool.get_connection(command_name, **options)
  File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 1192, in get_con
nection
    connection.connect()
  File "/usr/local/lib/python2.7/dist-packages/redis/connection.py", line 563, in connect
    raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error -2 connecting to localhost:8880:6379. Name or service not known.