ybrs / single-beat

ensures only one instance of your process across your servers
MIT License
172 stars 35 forks source link

show logging from underlying celery beat instance #22

Closed jadedarko closed 1 year ago

jadedarko commented 4 years ago

Is stdout for the child beat instance is only printed on termination of the parent single-beat instance?

I couldn't see a way to show this output, meaning my journalctl logs don't show task scheduling.

Is there a way to always print celery output in realtime to stdio?

robvdl commented 4 years ago

I have a fix for this, PR #28

robvdl commented 4 years ago

Basically what I was seeing is the child log lines would be bunched up and wouldn't appear until the parent process had something to log (which issued a flush).

By adding the flush in these two callbacks, log lines from the child process appear straight away.

ybrs commented 4 years ago

Again visiting this, maybe this should be optional ? like SINGLE_BEAT_UNBUFFERED=1 and flush at each line, because on the other hand, we are doing a double buffering (if that is a correct term), as in, child might be wanting to flush each line and we'd be buffering.

@robvdl What do you think about putting it into a config env. variable ? and making it optional ?

robvdl commented 4 years ago

Sounds good to me, I don't mind making it optional.

robvdl commented 4 years ago

Also flushing every line I don't think is a problem because:

1) beat doesn't log much at all 2) when it does, it always logs one line anyway "invoke task xyz"

Just my 2c

s4ke commented 2 years ago

Wouldn't the solution here be to "simply" run the child process in unbuffered mode?