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

Using circus library, stdout_stream and stderr_stream do not work #1161

Open
nicovillanueva opened this issue Apr 13, 2021 · 0 comments
Open

Comments

@nicovillanueva
Copy link

Related to this issue: #1149 but specific to using circus' library.

Issue

When creating a Watcher, both stdout_stream and stderr_stream do not work. For example, setting any/both to a FileStream to a given filename creates the file but it remains empty.

Example snippet

Create the following script somewhere, just to have something printing to stdout and stderr

import sys
import time

while True:
	print("hi - stdout", file=sys.stdout, flush=True)
	print("hi - stderr", file=sys.stderr, flush=True)
	time.sleep(0.5)

Then, create a Watcher which runs it, like so:

from circus.watcher import Watcher
import time

stdoutcfg = {
		"class": "circus.stream.FileStream",
                "filename": f"/home/user/watchertest.log",
                "max_bytes": 52428800,
                "backup_count": 5
            }
stderrcfg = {
		"class": "circus.stream.FileStream",
                "filename": f"/home/user/watchertest.err",
                "max_bytes": 52428800,
                "backup_count": 5
            }

w = Watcher(
	name='watchertest',
	cmd='python3',
	args='/home/user/printer.py',
	stdout_stream=stdoutcfg,
	stderr_stream=stderrcfg,
	stop_children=True
)
print(w.status())
w.start()
print(w.status())
print(w.info())
time.sleep(10)
print(w.status())
print(w.info())
w.stop()
print(w.status())
print(w.info())

(change the paths appropriately)
Run it, and notice how both files (stdout and err) remain at 0 bytes.

Expected

Both files to be populated with the stdout and err of the script.

Reproducibility

This is consistently reproducible in both Circus 0.16.1 and 0.17.1, on Linux.

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

No branches or pull requests

1 participant