Closed WesleyPeng closed 5 years ago
Thanks for the report. I'm gonna try to have a look at it this week.
I could reproduce the issue with the latest release. Now investigating.
The Chaostoolkit Prometheus depends on dateparser which relies on _strptime.py.
Unfortunately, this isn't bundled by pyinstaller in its latest version (of last September). See https://github.com/pyinstaller/pyinstaller/issues/3429
I tried some of the tricks they provide in that issue but with no luck so far.
Using https://github.com/Skehmatics/dateparser/commit/c03911a1a76aa384fe61b57401076da2cd6d972d and https://github.com/pyinstaller/pyinstaller most recent commit, the generated bundle works now.
However, the dateparser repo is a fork so I will not generate an official chaostoolkit bundle from it yet.
If you feel like generating one for yourself, here is how to go about it:
$ git clone https://github.com/chaostoolkit/chaostoolkit-bundler.git
$ cd chaostoolkit-bundler
$ python3 -m venv .venv
$ pip install -r requirements.txt -r requirements-chaostoolkit.txt
$ pip uninstall pyinstaller dateparser
$ pip install git+https://github.com/pyinstaller/pyinstaller.git
$ pip install git+https://github.com/Skehmatics/dateparser.git@feature/imp_deprecation
$ export CHAOSTOOLKIT_PATH=`which chaos`
$ pyinstaller chaos.spec
This will generate a binary in the dist/
directory.
@Lawouach I tried to generate the bundle by following the steps and the bundle works with chaosprometheus plugin. Thanks a lot!
{ "type": "probe", "name": "fetch-cpu-just-2mn-ago", "provider": { "type": "python", "module": "chaosprometheus.probes", "func": "query", "arguments": { "query": "process_cpu_seconds_total{job='websvc'}", "when": "2 minutes ago" } } }