Skip to content

Commit

Permalink
Improve worker error handler in tests and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
longquanzheng committed Sep 14, 2023
1 parent acd2b4a commit 64fcbfc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
Python SDK for [iWF workflow engine](https://github.com/indeedeng/iwf)

```
pip install iwf-python-sdk==0.1.0
pip install iwf-python-sdk==0.1.2
```

See [samples](https://github.com/indeedeng/iwf-python-samples) for examples.
See [samples](https://github.com/indeedeng/iwf-python-samples) for use case examples.

## Requirements

- Python 3.9+
- [iWF server](https://github.com/indeedeng/iwf#using-docker-image--docker-compose)
- [iWF server](https://github.com/indeedeng/iwf#how-to-use)

## Concepts

Expand Down
10 changes: 3 additions & 7 deletions iwf/tests/worker_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,11 @@ def handle_rpc():
return resp.to_dict()


# this handler is extremely useful for debugging iWF
# the WebUI will be able to show you the error with stacktrace
@_flask_app.errorhandler(Exception)
def internal_error(exception):
# TODO: how to print to std ??
response = exception.get_response()
# replace the body with JSON
response.data = traceback.format_exc()
response.content_type = "application/json"
response.status_code = 500
return response
return traceback.format_exc(), 500


_webApp = Thread(target=_flask_app.run, args=("0.0.0.0", 8802))
Expand Down

0 comments on commit 64fcbfc

Please sign in to comment.