chaostoolkit / chaostoolkit-bundler

Bundle the Chaos Toolkit CLI and all the drivers/plugins into one standalone binary for Linux, MacOSX and Windows
https://chaostoolkit.org/
Apache License 2.0
10 stars 4 forks source link

chaosprometheus.probes module was not found in activity while running with bundle file #3

Closed WesleyPeng closed 5 years ago

WesleyPeng commented 5 years ago

{ "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" } } }

Lawouach commented 5 years ago

Thanks for the report. I'm gonna try to have a look at it this week.

Lawouach commented 5 years ago

I could reproduce the issue with the latest release. Now investigating.

Lawouach commented 5 years ago

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.

Lawouach commented 5 years ago

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.

WesleyPeng commented 5 years ago

@Lawouach I tried to generate the bundle by following the steps and the bundle works with chaosprometheus plugin. Thanks a lot!