geopython / pywps

PyWPS is an implementation of the Web Processing Service standard from the Open Geospatial Consortium. PyWPS is written in Python.
https://pywps.org
MIT License
175 stars 117 forks source link

Make asynchronous process test run asynchronously #657

Closed huard closed 1 year ago

huard commented 2 years ago

Overview

The test in test_async was not running asynchronously. This PR runs the test with processing mode set to distributed, and confirms the process completes.

Related Issue / Discussion

Fix #656

Additional Information

I moved the Sleep process definition with the other test processes.

I had trouble initially because I thought owslib would be able to read the status file. Unfortunately, owslib does not support status files on the local file system.

Contribution Agreement

(as per https://github.com/geopython/pywps/blob/master/CONTRIBUTING.rst#contributions-and-licensing)

huard commented 2 years ago

test_async interferes with test_dblog. I solved this locally by shortening the sleep period, but that doesn't seem to be enough here. There should be a cleaner solution to isolate test_dblog.

huard commented 2 years ago

The update_status calls from the async process do not seem to be captured by the logging database in the test suite. This is explained here: https://www.sqlite.org/inmemorydb.html

Of course, all database connections sharing the in-memory database need to be in the same process

Ideas ?

coveralls commented 2 years ago

Coverage Status

Coverage increased (+0.5%) to 81.901% when pulling cbd1c29c1816f2ed21ee2bfe232e70a41328c448 on fix-656 into 7839f5276ced486a8b7f83379e919fb05273b4e7 on main.

huard commented 2 years ago

I just renamed the async test so its run at the end.

Note that some of the tests modify the CONFIG, and this has effects on the following tests. It would probably be best to make sure all tests that modify the config return it to its original state.

Note also that test_assync_inout is useless at the moment.

gschwind commented 2 years ago

Hello,

I did a quick code review, imo you should split dca06fb6518bc1e00bf7a3f54981496288c1005d

into: Refactor test.create_sleep into test.Sleep Change test_async to actually test asynchronous process.

and to split cbd1c29c1816f2ed21ee2bfe232e70a41328c448, with typo fix separated from the rest.

More over having a loop with proper status check instead of sleep(.5) maybe better in dca06fb6518bc1e00bf7a3f54981496288c1005d

huard commented 1 year ago

Replaced by #663 and #664