Skip to content

Commit 4221c06

Browse files
committed
Using unbuffered Python calls for cronjobs and systemd services
1 parent f6e1d73 commit 4221c06

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

content/en/docs/cluster/installation.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ After=docker.target
4343
[Service]
4444
Type=simple
4545
WorkingDirectory=/home/gc/green-metrics-tool/
46-
ExecStart=/home/gc/green-metrics-tool/venv/bin/python3 /home/gc/green-metrics-tool/cron/client.py
46+
ExecStart=/home/gc/green-metrics-tool/venv/bin/python3 -u /home/gc/green-metrics-tool/cron/client.py
4747
Restart=always
4848
RestartSec=30s
4949
TimeoutStopSec=600
@@ -80,7 +80,7 @@ Type=simple
8080
User=gc
8181
Group=gc
8282
WorkingDirectory=/home/gc/green-metrics-tool/
83-
ExecStart=/home/gc/green-metrics-tool/venv/bin/python3 /home/gc/green-metrics-tool/tools/client.py
83+
ExecStart=/home/gc/green-metrics-tool/venv/bin/python3 -u /home/gc/green-metrics-tool/tools/client.py
8484
Restart=always
8585
RestartSec=30s
8686
TimeoutStopSec=600
@@ -125,13 +125,13 @@ sudo chmod 500 /etc/sudoers.d/green-coding-cluster-cleanup
125125
The Green Metrics Tool comes with an implemented queueing and locking mechanism. In contrast to the NOP Linux implementation this way of checking for jobs doesn't poll with a process all the time but relies on cron which is not available on NOP Linux.
126126

127127
You can install a cronjob on your system to periodically call:
128-
- `python3 PATH_TO_GREEN_METRICS_TOOL/tools/jobs.py project` to measure projects in database queue
129-
- `python3 PATH_TO_GREEN_METRICS_TOOL/tools/jobs.py email` to send all emails in the database queue
128+
- `python3 -u PATH_TO_GREEN_METRICS_TOOL/tools/jobs.py project` to measure projects in database queue
129+
- `python3 -u PATH_TO_GREEN_METRICS_TOOL/tools/jobs.py email` to send all emails in the database queue
130130

131131
The `jobs.py` uses the *Python* faulthandler mechanism and will also report to *STDERR* in case of a segfault.
132132
When running the cronjob we advice you to append all the output combined to a log file like so:
133133

134-
`* * * * * python3 PATH_TO_GREEN_METRICS_TOOL/tools/jobs.py project &>> /var/log/green-metrics-jobs.log`
134+
`* * * * * python3 -u PATH_TO_GREEN_METRICS_TOOL/tools/jobs.py project &>> /var/log/green-metrics-jobs.log`
135135

136136
Be sure to give the `green-metrics-jobs.log` file write access rights.
137137

0 commit comments

Comments
 (0)