Closed jbants closed 7 years ago
Hi,
It looks like the test cases are hitting the endpoint. What output do you see when you first start the server? E.g. On my system I get:
$ python app.py
Using logfile: ../log/h5serv.log
password_uri config: ../util/admin/passwd.h5
Setting log level to: INFO
INFO:app.py:3164::log test
dirname path:
favicon_path: favicon.ico
Static content in the path:../static will be displayed via the url: /views/(.*)
isdebug: True
domain: hdfgroup.org
ssl_port: 6050
Setting watchdog on: ../data/
INFO:passwordUtil.py:56::getAuthClient
INFO:passwordUtil.py:58::password_uri:../util/admin/passwd.h5
INFO:authFile.py:36::AuthFile class init(../util/admin/passwd.h5)
INFO:app.py:3216::INITIALIZING...
INFO:app.py:3217::Starting event loop on port: 5000
Starting event loop on port: 5000
Once the server is started, what does curl return? E.g.:
$ curl http://127.0.0.1:5000/
{"lastModified": "2016-11-20T02:15:20Z", "created": "2016-11-20T02:15:20Z", "root": "2ff0219c-aec7-11e6-b6c9-3c15c2da029e", "hrefs": [{"href": "http://127.0.0.1:5000/", "rel": "self"}, {"href": "http://127.0.0.1:5000/datasets", "rel": "database"}, {"href": "http://127.0.0.1:5000/groups", "rel": "groupbase"}, {"href": "http://127.0.0.1:5000/datatypes", "rel": "typebase"}, {"href": "http://127.0.0.1:5000/groups/2ff0219c-aec7-11e6-b6c9-3c15c2da029e", "rel": "root"}]}
BTW, I've updated the readthedocs instructions (to use pip for watchdog).
Also, Are you running testall.py from the AWS machine or externally? If externally, the testscript won't work since it's trying to do things like copy files to the server data directory.
Hi @jreadey, thanks for looking into this and updating the docs.
When i run python app.py --datapath=/data I get the following:
('Using logfile: ', '../log/h5serv.log')
('password_uri config:', '../util/admin/passwd.h5')
Setting log level to: INFO
INFO:app.py:3164::log test
('dirname path:', '')
('favicon_path:', 'favicon.ico')
Static content in the path:../static will be displayed via the url: /views/(.*)
('isdebug:', True)
('domain:', 'hdfgroup.org')
('ssl_port:', 6050)
('Setting watchdog on: ', '/data')
INFO:passwordUtil.py:56::getAuthClient
INFO:passwordUtil.py:58::password_uri:../util/admin/passwd.h5
INFO:authFile.py:36::AuthFile class init(../util/admin/passwd.h5)
INFO:app.py:3216::INITIALIZING...
INFO:app.py:3217::Starting event loop on port: 5000
Starting event loop on port: 5000
curl yields:
curl http://127.0.0.1:5000/
{"lastModified": "2016-11-20T00:18:29Z", "hrefs": [{"href": "http://127.0.0.1:5000/", "rel": "self"}, {"href": "http://127.0.0.1:5000/datasets", "rel": "database"}, {"href": "http://127.0.0.1:5000/groups", "rel": "groupbase"}, {"href": "http://127.0.0.1:5000/datatypes", "rel": "typebase"}, {"href": "http://127.0.0.1:5000/groups/a0d1564e-aeb6-11e6-9dd1-0670fd626c9f", "rel": "root"}], "root": "a0d1564e-aeb6-11e6-9dd1-0670fd626c9f", "created": "2016-11-20T00:18:29Z"}
Im running these directly on the AWS machine.
That's odd.
Try running just one of the failing test cases. Cd to h5serv/test/integ and run:
$ python roottest.py RootTest.testGetDomain
Does the test case pass and what output do you see from the h5serv log?
Running the roottest
python roottest.py RootTest.testGetDomain
E
======================================================================
ERROR: testGetDomain (__main__.RootTest)
----------------------------------------------------------------------
Traceback (most recent call last):
File "roottest.py", line 37, in testGetDomain
rsp = requests.get(req, headers=headers)
File "/home/ubuntu/anaconda2/envs/bluegeo/lib/python2.7/site-packages/requests/api.py", line 70, in get
return request('get', url, params=params, **kwargs)
File "/home/ubuntu/anaconda2/envs/bluegeo/lib/python2.7/site-packages/requests/api.py", line 56, in request
return session.request(method=method, url=url, **kwargs)
File "/home/ubuntu/anaconda2/envs/bluegeo/lib/python2.7/site-packages/requests/sessions.py", line 488, in request
resp = self.send(prep, **send_kwargs)
File "/home/ubuntu/anaconda2/envs/bluegeo/lib/python2.7/site-packages/requests/sessions.py", line 609, in send
r = adapter.send(request, **kwargs)
File "/home/ubuntu/anaconda2/envs/bluegeo/lib/python2.7/site-packages/requests/adapters.py", line 487, in send
raise ConnectionError(e, request=request)
ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=5000): Max retries exceeded with url: / (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7f3f3a2bb910>: Failed to establish a new connection: [Errno 111] Connection refused',))
----------------------------------------------------------------------
Ran 1 test in 0.005s
FAILED (errors=1)
I rotated the log files and run the above. Nothing was written to the new log file and this is the output in the log file after running the server again. (assuming it's writing to /h5serv/log/h5serv.log)
2016-11-20 05:36:02,609:INFO:app.py:3164::log test
2016-11-20 05:36:02,614:INFO:passwordUtil.py:56::getAuthClient
2016-11-20 05:36:02,614:INFO:passwordUtil.py:58::password_uri:../util/admin/passwd.h5
2016-11-20 05:36:02,615:INFO:authFile.py:36::AuthFile class init(../util/admin/passwd.h5)
2016-11-20 05:36:02,615:INFO:app.py:3216::INITIALIZING...
2016-11-20 05:36:02,615:INFO:app.py:3217::Starting event loop on port: 5000
2016-11-20 05:36:24,851:INFO:app.py:284::getFilePath: 54.186.250.126:5000 checkExists: True
2016-11-20 05:36:24,851:INFO:app.py:286::tocFilePath: /data/.toc.h5
2016-11-20 05:36:24,851:INFO:app.py:321::verifyFile: /data/.toc.h5
2016-11-20 05:36:24,852:INFO:fileUtil.py:266::verifyFile('/data/.toc.h5', False)
2016-11-20 05:36:24,852:INFO:app.py:188::baseHandler, href: http://54.186.250.126:5000
2016-11-20 05:36:24,852:INFO:app.py:194::REQ GET http://54.186.250.126:5000/ {remote_ip: 50.66.101.142}
2016-11-20 05:36:24,852:INFO:hdf5db.py:163::init -- filePath: /data/.toc.h5 mode: r+
2016-11-20 05:36:24,853:INFO:hdf5db.py:194::Hdf5db __enter
2016-11-20 05:36:24,853:INFO:hdf5db.py:713::getUUIDByPath: [/]
2016-11-20 05:36:24,854:INFO:hdf5db.py:198::Hdf5db __exit
2016-11-20 05:36:27,986:WARNING:app.py:2961::Caught signal: 2
2016-11-20 05:36:27,987:INFO:app.py:2968::Stopping http server
2016-11-20 05:36:27,987:INFO:app.py:2971::Will shutdown in 2 seconds ...
2016-11-20 05:36:27,987:INFO:app.py:2985::closing db
2016-11-20 05:36:29,988:INFO:app.py:2982::Shutdown
And your sure you are running the test from the same host? :)
What does:
$ lsof -i :5000
Return?
Could there be some firewall software running on the host?
Yup, im sshing into the ubuntu machine and running everything from there.
lsof -i :5000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
python 1510 ubuntu 9u IPv4 17146 0t0 TCP *:5000 (LISTEN)
python 1510 ubuntu 10u IPv6 17147 0t0 TCP *:5000 (LISTEN)
If i run the server in one console and the root test in another, i get this error printed to console for the server.
ERROR:tornado.application:Uncaught exception GET / (127.0.0.1)
HTTPServerRequest(protocol='http', host='tall.test.hdfgroup.org', method='GET', uri='/', version='HTTP/1.1', remote_ip='127.0.0.1', headers={'Connection': 'keep-alive', 'User-Agent': 'python-request/2.12.1', 'Host': 'tall.test.hdfgroup.org', 'Accept': '*/*', 'Accept-Encoding': 'gzip, deflate'})
Traceback (most recent call last):
File "/home/ubuntu/anaconda2/envs/bluegeo/lib/python2.7/site-packages/tornado/web.py", line 1467, in _execute
result = method(*self.path_args, **self.path_kwargs)
File "app.py", line 2801, in get
self.baseHandler()
File "app.py", line 185, in baseHandler
self.filePath = self.getFilePath(self.domain, checkExists)
File "app.py", line 288, in getFilePath
tocUtil.createTocFile(tocFilePath)
File "/home/ubuntu/h5serv/server/tocUtil.py", line 212, in createTocFile
f = h5py.File(toc_file, 'w')
File "/home/ubuntu/anaconda2/envs/bluegeo/lib/python2.7/site-packages/h5py/_hl/files.py", line 272, in __init__
fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
File "/home/ubuntu/anaconda2/envs/bluegeo/lib/python2.7/site-packages/h5py/_hl/files.py", line 98, in make_fid
fid = h5f.create(name, h5f.ACC_TRUNC, fapl=fapl, fcpl=fcpl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper (/home/ilan/minonda/conda-bld/work/h5py/_objects.c:2696)
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper (/home/ilan/minonda/conda-bld/work/h5py/_objects.c:2654)
File "h5py/h5f.pyx", line 96, in h5py.h5f.create (/home/ilan/minonda/conda-bld/work/h5py/h5f.c:2109)
IOError: Unable to create file (Unable to open file: name = '/data/.toc.h5', errno = 13, error message = 'permission denied', flags = 13, o_flags = 242)
ERROR:tornado.access:500 GET / (127.0.0.1) 4.28ms
The same user that installed hd5py is running the test and server and i have verified that they are the owner of /data.toc.h5.
My usual setup is to have the server running in one console and the test code running in another. That way it's easy to compare the test output with what the server log is generating.
I noticed the data directory is "/data". The default (which you can verify by looking at the datapath key of h5serv/server/config.py) is "../data". Did you override the default location?
On the first request the server receives it will create a file: ".toc.h5" in the data directory. Do you see these file? Verify that the user can create files in this directory by doing something like: "touch foo".
Ah ok. Yea, i set up a different data directory on another volume just from more storage space.
Running the server without the --datapath flag in one console and the tests in another console results in all tests passing. I assume i can run the server with the datapath pointing to another volume in 'production' mode without issues. It's just the tests that need the default server parameters.
Thanks for your help in clearing this up. Really looking forward to using this!
Great, glad we got things sorted out.
If you'd really like to run the test case with data in the /data directory, you can modify line 20 of h5serv/test/integ/setupdata.py. Just change DES = "../../data" to the location you want.
I've set up a vanilla Ubuntu 16.04 machine on AWS and followed the instruction tutorials here. I've set the security group with access to port 5000. The conda install command failed because it wasn't able to find watchdog so I installed watchdog using pip. I can run the server as outlined in the documentation and can reach the api endpoint. However, when i run the tests i get a connection error.
Any Ideas? Test output is below.
Thanks.