run a worker and return its stderr :param name: the name of the worker :param env: the environment to run the worker in worker must be running in other process because of avoiding conflict.
(name, env)
| 28 | |
| 29 | |
| 30 | def get_worker_error_messages(name, env): |
| 31 | """run a worker and return its stderr |
| 32 | |
| 33 | :param name: the name of the worker |
| 34 | :param env: the environment to run the worker in |
| 35 | |
| 36 | worker must be running in other process because of avoiding conflict.""" |
| 37 | worker = subprocess.Popen( |
| 38 | [ |
| 39 | "celery", |
| 40 | "--config", |
| 41 | "t.integration.test_serialization_config", |
| 42 | "worker", |
| 43 | "-c", |
| 44 | "2", |
| 45 | "-n", |
| 46 | f"{name}@%%h", |
| 47 | ], |
| 48 | stderr=subprocess.PIPE, |
| 49 | stdout=subprocess.PIPE, |
| 50 | env=env, |
| 51 | ) |
| 52 | worker.terminate() |
| 53 | err = worker.stderr.read().decode("utf-8") |
| 54 | return err |