Comments (5)
I am not a python developer, but I read https://stackoverflow.com/questions/107705/disable-output-buffering and found this patch works:
diff --git a/dish_grpc_text.py b/dish_grpc_text.py
index 29b844e..52821e9 100644
--- a/dish_grpc_text.py
+++ b/dish_grpc_text.py
@@ -110,7 +110,7 @@ def parse_args():
def open_out_file(opts, mode):
if opts.out_file == "-":
# open new file, so it can be closed later without affecting sys.stdout
- return os.fdopen(sys.stdout.fileno(), "w", closefd=False)
+ return os.fdopen(sys.stdout.fileno(), "w", 1, closefd=False)
return open(opts.out_file, mode, buffering=1)
from starlink-grpc-tools.
By default, Python will buffer stdout unless it is a TTY, so redirecting into a pipe (or a file, for that matter) will cause it to buffer.
I thought about forcing it to line buffer, at least in the text output script, but that seems to me that it would be taking away flexibility in case someone actually wants it to buffer. I also thought about making it a command line option, but there is already a command line option to the python
executable that will prevent it from buffering: the -u
option. For example:
python3 -u dish_grpc_text.py status -t 1|cat
should do what you want.
I could probably be convinced that it would be better to just always line buffer in that script. In my own usage, I use that -u
interpreter option because I redirect to a file and I try to minimize data loss when the power goes out, and I can't really think of a use case where someone needs it to be block buffered.
from starlink-grpc-tools.
-u does not work for me. (Python 3.10.4)
Note that this also breaks basic use with grep if you just want to watch a single value for changes while looping..
from starlink-grpc-tools.
As far as I can see, the only benefit to block buffering is fewer syscalls. But why would you be worried about a few syscalls when running this in a loop?
from starlink-grpc-tools.
-u does not work for me. (Python 3.10.4)
Oh. Yeah. I probably broke this when I changed it to reopen the output file in order to support specifying a file for output. Even if that weren't the case, I think I agree with you that there really isn't any benefit to block buffering for this script, given the data rate.
I will change it to always line buffer the output.
from starlink-grpc-tools.
Related Issues (20)
- TypedDicts have type Any in IDE HOT 5
- no attribute 'wedge_abs_fraction_obstructed' HOT 5
- Make robust against field removal in grpc protocol HOT 2
- Error in "Running with SystemD" instructions HOT 2
- Need to wrap Environment variables within /etc/systemd/system/starlink-influx2.service with " " HOT 6
- Make work on arm64 (aka Raspberry Pi) HOT 15
- Docker image missing generated gRPC protocol modules HOT 3
- Did Starlink disable the gRPC/web interface? HOT 2
- Remote API HOT 6
- Zabbix Template for Starlink Dishy HOT 3
- wifi_util.proto missing HOT 1
- Unknown Alert code 384 HOT 2
- MessageFactory class is deprecated HOT 3
- Is it possible to poll RSSI values? HOT 2
- is it possible to query satellite coordinates from the gRPC interface? HOT 1
- How does the Bandwidth usage works ? HOT 12
- Obstruction map - which way is "up" ? HOT 2
- Get sleep mode status? HOT 6
- Docker image: Failed writing to InfluxDB HOT 2
- Check for and trigger software updates HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from starlink-grpc-tools.