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

Activate async test #3

Closed
wants to merge 400 commits into from
Closed

Conversation

huard
Copy link

@huard huard commented Sep 19, 2022

Overview

A unit test for asynchronous processes was not actually running asynchronously. The test now runs in async mode and will raise an error if it ever runs synchronously.

Related Issue / Discussion

In response to comments in geopython#657

Additional Information

Contribution Agreement

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

  • I'd like to contribute [feature X|bugfix Y|docs|something else] to PyWPS. I confirm that my contributions to PyWPS will be compatible with the PyWPS license guidelines at the time of contribution.
  • I have already previously agreed to the PyWPS Contributions and Licensing Guidelines

cehbrecht and others added 30 commits December 11, 2018 18:45
* update release howto ... skip develop branch

* update changelog
* switched default supported_formats to empty tuple
* ComplexOutput as_reference=false bug fix (geopython#412)
Do not call Session.close_all as this will close all the Sessions
that exist in memory, including the sessions that are specific to
the application and unrelated to PyPWS.

And here the closing of sessions is already handled by
_LAST_SESSION.close(), so we can just remove the call to
_SESSION_MAKER.close_all.
* created tests for io data round-trip. simplified json output logic.

* pep8

* added other option to create request

* reintroduced CDATA tag for types other than xml or base64

* renamed test file

* remove cdata for base64
* remove unnecessary error message in logs

(When an exception is instanciated, it is logged. Even if it's not
raised. So don't instantiate it unless there is an actual error)

* change description and locator properties for error messages

* fix indentation
* get running and stored counts in the same session to minimize...

race conditions

* when calling launch_next_process, make sure 2 threads don't take...

the same request

* fix and add more logging messages

* when calling launch_next_process, the `store_status_file` must be...

set manually, just like `async`

* missing import

* use a lock to make sure the engine is created once per process...

and don't reuse the same session every time. Create a new one as needed.

* remove unused function
annoying for sync requests and tests. The purpose of this timer is to
cover a case when a request finishes more or less at the same
time another is stored. The stored request is not started until another
request ends.
remove a sleep timer that is only useful for async requests
* when deserializing the WPSRequest, the inputs should be from ...

pywps.inout.inputs instead of pywps.inout.basic

* fixes for deserialization of a complex input of type file or url

* tests: remove __init__.py in requests folder containng static xml files

This folder was getting confused with the `requests` module

* fix error message missing description and uniformize messages

* move json serialization methods from WPSRequest.json to inout.inputs...

I put them in inout.inputs instead of inout.basic because
ComplexInput.json was already there and json methods for outputs are in
inout.outputs, not in inout.basic

* fix a circular dependency between inout.formats and ...

validator.complexvalidator. In all cases where Format is instantiated,
the `validate` property is set. So this shouldn't break existing code.

I prefer this solution to having a delayed import...

* add __eq__ mathods for testing values comparison

* json method has moved from inout.basic to inout.inputs

* fix handling and validation of allowed_values property

* add workdir to docstrings

* the `max_size` property of the ComplexInput is always queried from...

the global settings. It's not managed at a per-instance level.
So I removed the property and the unused method that was fetching
it from the configuration.

* add missing metadata to ComplexInput serialization

* handle serialization of 'file', 'data', 'stream' and 'url' ...

ComplexInput types.

* unused imports

* add serialization tests for ComplexInputs, LiteralInput and ...

BoundingBoxInput

* add title property. The serialization tests should really test the ...

classes in inout.inputs, as they are the classes used by the api.

* `uom` doesn't need to be serialized, because `uoms` is

* the AnyValue property should be kept when creating an input from json.

This makes the serialization code simpler, as we don't have to check
for the any_value flag, like it does currently...

* typo

* serialize both 'uoms' and 'uom' in LiteralInput because there can ...

be more than one

* add missing metadata in LiteralInput serialization

* add expected CDATA tag

* add missing 'workdir' parameter passed to DataHandler.__init__

* remove redundant comment

* BoundingBoxOutput should inherit from basic.BBoxOutput, not BBoxInput

* add json serialization to BoundingBoxOutput

* add simple docstrings

* add Metadata serialization

* fix redefinition of data variable
Zeitsperre and others added 29 commits December 21, 2021 18:44
Update deprecated logging.warn() call
Modernize CI using Tox, add a "[dev]" recipe, re-enable coveralls
* Fixed the JSON encoding of the CRS type which crashed when the execution request was serialized

* Fixed the JSON encoding of the CRS type by making sure the CRS is always set as string when parsing input
Also added tests

* Changed converting the string conversion of the crs input to calling the getcodeurn() method directly

* Now setting bbox CRS handles None values properly
Add test that check if binary data are correctly serialized to json in
ComplexInput. The case append when json input are base64 encoded in the
XML request.
Within the pywps.inout.inputs.ComplexInput the json convertion function
use encode where decode should be used. The patch fix this issue.
Update test section in README.md about pytest
Add test that check if binary data are correctly serialized to json in
ComplexInput. The case append when json input are base64 encoded in the
XML request.
…ge-2

Fix ComplexInput.from_json to handle data_format.encoding="base64"
Change coveralls branch from master to main
* update changes

* bumpversion
Using mutable value as default value for input variable of function
create complex bug because those value will be shared by all Process
instance. Thus remove it and replace it by the safe code.
DetachProcesing intended to replace the broken MultiProcessing. Detach
process will create a sub-process that will be detached from it's parent
process, i.e. the parent pid will be 1. That way prevent sub-process to
stay in zombie mode, as the default MultiProcessing do.

This mode is crafted for linux platform. To use it add the following
configuration:

[processing]
mode=detachprocessing
In the current code the sub-process PID is set once to a wring value,
this function allow the sub-process to update the PID to the actual
value.
The dblog.cleanup_crashed_process implement an heuristic to detect
crashed sub-process, i.e. process that did not terminated in the
expected way. This may happen if user use kill with SIGKILL or the
process get killed by OOM killer or the process exit by himself with
exit(0) or some case that I do not have in mind. In this case the
process entry in the database is not updated properly to reflect the
fact that the process has finished. This process entry stack up and
block new request to be processed. This function prevent this by
checking if a process with the same pid still alive, if not process with
the same pid is found we are sure that the process is not running
anymore, thus we update is status as failed.

Currently this function is called when the limit of parralle request is
reach to check if some process are crashed.
Remove use of mutable as default value in Process.__init__
…esses/__init__.py where other test processes are to facilitate reuse.
@huard huard closed this Sep 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.